Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include<stdio.h>
#include<string.h>
int main()
{
int i,j,minj,n,flag=1,cmp,hantei=0;
char b[36][3],s[36][3],sw[36][3];
/*??\???*/
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",b[i]);
strcpy(s[i],b[i]);
}
i=0;
while(flag){
flag = 0;
for (j = n - 1; j >= i+1; j--) {
if (b[j - 1][1] > b[j][1]) {
strcpy(sw[j],b[j]);
strcpy( b[j],b[j - 1]);
strcpy( b[j - 1],sw[j]);
flag = 1;
}
}
i++;
}
for(i=0;i<n;i++){
minj = i;
for(j=i;j<n;j++){
if(s[j][1] < s[minj][1]){
minj = j;
}
}
if(i != minj){
strcpy(sw[i] ,s[i]);
strcpy(s[i],s[minj]);
strcpy(s[minj],sw[i]);
}
}
/*BS??????*/
for(i=0;i<n-1;i++){
printf("%s ",b[i]);
}
printf("%s",b[i]);
printf("\n");
printf("Stable\n");
/*SS??????*/
for(j=0;j<n-1;j++){
printf("%s ",s[j]);
}
printf("%s",s[j]);
printf("\n");
flag = 1;
for(i=0;i<n;i++){
if(strcmp(&b[i][0],&s[i][0])!=0 && hantei==0){
printf("Not stable\n");
flag=0;
hantei++;
}
}
if(flag==1){
printf("Stable\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113323/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113323/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%s \00", align 1
@str.6 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%b = alloca [36 x [3 x i8]], align 16
%s = alloca [36 x [3 x i8]], align 16
%sw = alloca [36 x [3 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %b) #6
call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %sw) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp1210 = icmp sgt i32 %0, 0
br i1 %cmp1210, label %for.body, label %entry.while.cond.preheader_crit_edge
entry.while.cond.preheader_crit_edge: ; preds = %entry
%.pre261 = sext i32 %0 to i64
br label %while.cond.preheader
while.cond.preheader: ; preds = %for.body, %entry.while.cond.preheader_crit_edge
%.pre-phi = phi i64 [ %.pre261, %entry.while.cond.preheader_crit_edge ], [ %3, %for.body ]
%1 = phi i32 [ %0, %entry.while.cond.preheader_crit_edge ], [ %2, %for.body ]
br label %for.cond10.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%arrayidx4 = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv
%call9 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx4, ptr noundef nonnull dereferenceable(1) %arrayidx) #6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp1, label %for.body, label %while.cond.preheader, !llvm.loop !9
while.cond.loopexit: ; preds = %for.inc46
%tobool.not = icmp eq i32 %flag.2, 0
br i1 %tobool.not, label %for.cond49.preheader, label %for.cond10.preheader, !llvm.loop !11
for.cond10.preheader: ; preds = %while.cond.preheader, %while.cond.loopexit
%indvars.iv243 = phi i64 [ 0, %while.cond.preheader ], [ %indvars.iv.next244, %while.cond.loopexit ]
%indvars.iv.next244 = add nuw nsw i64 %indvars.iv243, 1
%cmp11.not.not213 = icmp sgt i64 %.pre-phi, %indvars.iv.next244
br i1 %cmp11.not.not213, label %for.body12, label %for.cond49.preheader
for.cond49.preheader: ; preds = %for.cond10.preheader, %while.cond.loopexit
%cmp50222 = icmp sgt i32 %1, 0
br i1 %cmp50222, label %for.cond53.preheader.preheader, label %for.end111
for.cond53.preheader.preheader: ; preds = %for.cond49.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.cond53.preheader
for.body12: ; preds = %for.cond10.preheader, %for.inc46
%indvars.iv239 = phi i64 [ %indvars.iv.next240, %for.inc46 ], [ %.pre-phi, %for.cond10.preheader ]
%flag.1215 = phi i32 [ %flag.2, %for.inc46 ], [ 0, %for.cond10.preheader ]
%indvars.iv.next240 = add nsw i64 %indvars.iv239, -1
%4 = add nsw i64 %indvars.iv239, -2
%arrayidx16 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %4, i64 1
%5 = load i8, ptr %arrayidx16, align 1, !tbaa !12
%arrayidx19 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %indvars.iv.next240, i64 1
%6 = load i8, ptr %arrayidx19, align 1, !tbaa !12
%cmp21 = icmp sgt i8 %5, %6
br i1 %cmp21, label %if.then, label %for.inc46
if.then: ; preds = %for.body12
%arrayidx18 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %indvars.iv.next240
%arrayidx15 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %4
%arrayidx24 = getelementptr inbounds [36 x [3 x i8]], ptr %sw, i64 0, i64 %indvars.iv.next240
%call29 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx24, ptr noundef nonnull dereferenceable(1) %arrayidx18) #6
%call37 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx18, ptr noundef nonnull dereferenceable(1) %arrayidx15) #6
%call45 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx15, ptr noundef nonnull dereferenceable(1) %arrayidx24) #6
br label %for.inc46
for.inc46: ; preds = %for.body12, %if.then
%flag.2 = phi i32 [ 1, %if.then ], [ %flag.1215, %for.body12 ]
%cmp11.not.not = icmp sgt i64 %indvars.iv.next240, %indvars.iv.next244
br i1 %cmp11.not.not, label %for.body12, label %while.cond.loopexit, !llvm.loop !13
for.cond53.preheader: ; preds = %for.cond53.preheader.preheader, %for.inc97
%indvars.iv246 = phi i64 [ 0, %for.cond53.preheader.preheader ], [ %indvars.iv.next247, %for.inc97 ]
%7 = trunc i64 %indvars.iv246 to i32
br label %for.body56
for.cond100.preheader: ; preds = %for.inc97
%cmp102225 = icmp sgt i32 %1, 1
br i1 %cmp102225, label %for.body104, label %for.end111
for.body56: ; preds = %for.cond53.preheader, %for.body56
%indvars.iv248 = phi i64 [ %indvars.iv246, %for.cond53.preheader ], [ %indvars.iv.next249, %for.body56 ]
%minj.0221 = phi i32 [ %7, %for.cond53.preheader ], [ %spec.select, %for.body56 ]
%arrayidx59 = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv248, i64 1
%8 = load i8, ptr %arrayidx59, align 1, !tbaa !12
%idxprom61 = sext i32 %minj.0221 to i64
%arrayidx63 = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %idxprom61, i64 1
%9 = load i8, ptr %arrayidx63, align 1, !tbaa !12
%cmp65 = icmp slt i8 %8, %9
%10 = trunc i64 %indvars.iv248 to i32
%spec.select = select i1 %cmp65, i32 %10, i32 %minj.0221
%indvars.iv.next249 = add nuw nsw i64 %indvars.iv248, 1
%cmp54 = icmp slt i64 %indvars.iv.next249, %.pre-phi
br i1 %cmp54, label %for.body56, label %for.end71, !llvm.loop !14
for.end71: ; preds = %for.body56
%11 = zext i32 %spec.select to i64
%cmp72.not = icmp eq i64 %indvars.iv246, %11
br i1 %cmp72.not, label %for.inc97, label %if.then74
if.then74: ; preds = %for.end71
%arrayidx76 = getelementptr inbounds [36 x [3 x i8]], ptr %sw, i64 0, i64 %indvars.iv246
%arrayidx79 = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv246
%call81 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx76, ptr noundef nonnull dereferenceable(1) %arrayidx79) #6
%idxprom85 = sext i32 %spec.select to i64
%arrayidx86 = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %idxprom85
%call88 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx79, ptr noundef nonnull dereferenceable(1) %arrayidx86) #6
%call95 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx86, ptr noundef nonnull dereferenceable(1) %arrayidx76) #6
br label %for.inc97
for.inc97: ; preds = %for.end71, %if.then74
%indvars.iv.next247 = add nuw nsw i64 %indvars.iv246, 1
%exitcond.not = icmp eq i64 %indvars.iv.next247, %wide.trip.count
br i1 %exitcond.not, label %for.cond100.preheader, label %for.cond53.preheader, !llvm.loop !15
for.body104: ; preds = %for.cond100.preheader, %for.body104
%indvars.iv252 = phi i64 [ %indvars.iv.next253, %for.body104 ], [ 0, %for.cond100.preheader ]
%arrayidx106 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %indvars.iv252
%call108 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx106)
%indvars.iv.next253 = add nuw nsw i64 %indvars.iv252, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%sub101 = add nsw i32 %12, -1
%13 = sext i32 %sub101 to i64
%cmp102 = icmp slt i64 %indvars.iv.next253, %13
br i1 %cmp102, label %for.body104, label %for.end111.loopexit, !llvm.loop !16
for.end111.loopexit: ; preds = %for.body104
%14 = and i64 %indvars.iv.next253, 4294967295
br label %for.end111
for.end111: ; preds = %for.cond49.preheader, %for.end111.loopexit, %for.cond100.preheader
%i.3.lcssa = phi i64 [ 0, %for.cond100.preheader ], [ %14, %for.end111.loopexit ], [ 0, %for.cond49.preheader ]
%arrayidx113 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %i.3.lcssa
%call115 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx113)
%putchar = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%15 = load i32, ptr %n, align 4, !tbaa !5
%cmp120229 = icmp sgt i32 %15, 1
br i1 %cmp120229, label %for.body122, label %for.end129
for.body122: ; preds = %for.end111, %for.body122
%indvars.iv255 = phi i64 [ %indvars.iv.next256, %for.body122 ], [ 0, %for.end111 ]
%arrayidx124 = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv255
%call126 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx124)
%indvars.iv.next256 = add nuw nsw i64 %indvars.iv255, 1
%16 = load i32, ptr %n, align 4, !tbaa !5
%sub119 = add nsw i32 %16, -1
%17 = sext i32 %sub119 to i64
%cmp120 = icmp slt i64 %indvars.iv.next256, %17
br i1 %cmp120, label %for.body122, label %for.end129.loopexit, !llvm.loop !17
for.end129.loopexit: ; preds = %for.body122
%18 = and i64 %indvars.iv.next256, 4294967295
br label %for.end129
for.end129: ; preds = %for.end129.loopexit, %for.end111
%j.2.lcssa = phi i64 [ 0, %for.end111 ], [ %18, %for.end129.loopexit ]
%arrayidx131 = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %j.2.lcssa
%call133 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx131)
%putchar207 = call i32 @putchar(i32 10)
%19 = load i32, ptr %n, align 4, !tbaa !5
%cmp136232 = icmp sgt i32 %19, 0
br i1 %cmp136232, label %for.body138.outer, label %if.then159
for.body138.outer: ; preds = %for.end129, %for.inc154.thread
%.ph = phi i32 [ %.pre, %for.inc154.thread ], [ %19, %for.end129 ]
%indvars.iv258.ph = phi i64 [ %indvars.iv.next259268, %for.inc154.thread ], [ 0, %for.end129 ]
%cmp148 = phi i1 [ false, %for.inc154.thread ], [ true, %for.end129 ]
%20 = sext i32 %.ph to i64
br label %for.body138
for.body138: ; preds = %for.body138.outer, %for.inc154
%indvars.iv258 = phi i64 [ %indvars.iv.next259, %for.inc154 ], [ %indvars.iv258.ph, %for.body138.outer ]
%arrayidx140 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %indvars.iv258
%arrayidx143 = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv258
%call145 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx140, ptr noundef nonnull dereferenceable(1) %arrayidx143) #7
%cmp146 = icmp ne i32 %call145, 0
%or.cond = and i1 %cmp146, %cmp148
br i1 %or.cond, label %for.inc154.thread, label %for.inc154
for.inc154: ; preds = %for.body138
%indvars.iv.next259 = add nuw nsw i64 %indvars.iv258, 1
%cmp136 = icmp slt i64 %indvars.iv.next259, %20
br i1 %cmp136, label %for.body138, label %for.end156, !llvm.loop !18
for.inc154.thread: ; preds = %for.body138
%puts209 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%.pre = load i32, ptr %n, align 4, !tbaa !5
%indvars.iv.next259268 = add nuw nsw i64 %indvars.iv258, 1
%21 = sext i32 %.pre to i64
%cmp136269 = icmp slt i64 %indvars.iv.next259268, %21
br i1 %cmp136269, label %for.body138.outer, label %if.end161, !llvm.loop !18
for.end156: ; preds = %for.inc154
br i1 %cmp148, label %if.then159, label %if.end161
if.then159: ; preds = %for.end129, %for.end156
%puts208 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %if.end161
if.end161: ; preds = %for.inc154.thread, %if.then159, %for.end156
call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %sw) #6
call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %s) #6
call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
|
#include<stdio.h>
#define STABLE 1
#define NOT_STABLE 0
int BubbleSort( char Suit[], char Number[], int Order[], int n ){
int i,j,k;
char c;
for ( i = 0 ; i < n ; i++ ){
for ( j = n - 1 ; j > i ; j-- ){
if ( Number[j] < Number[ j - 1 ] ) {
c = Suit[j];
Suit[j] = Suit[ j - 1 ];
Suit[ j - 1 ] = c;
c = Number[j];
Number[j] = Number[ j - 1 ];
Number[ j - 1 ] = c;
k = Order[j];
Order[j] = Order[ j - 1 ];
Order[ j - 1 ] = k;
}
}
}
return 0;
}
int SelectionSort( char Suit[], char Number[], int Order[], int n ){
int i,j,k,minj;
char c;
for ( i = 0 ; i < n ; i++ ){
minj = i;
for( j = i ; j < n ; j++ ){
if ( Number[j] < Number[minj] ){
minj = j;
}
}
c = Suit[i];
Suit[i] = Suit[minj];
Suit[minj] = c;
c = Number[i];
Number[i] = Number[minj];
Number[minj] = c;
k = Order[i];
Order[i] = Order[minj];
Order[minj] = k;
}
return 0;
}
int is_stable( char Suit[], char Number[], int Order[], int n ){
int i;
for ( i = 0 ; i < n - 1 ; i++ ){
if ( Number[i] == Number[ i + 1 ] && Order[i] > Order[ i + 1 ] ) {
return NOT_STABLE;
}
}
return STABLE;
}
int main(){
int i,n;
scanf("%d", &n );
char Suit[37],Number[37],c;
int Order[37];
for ( i = 0 ; i < n ; i++ ){
scanf("%c", &c );
scanf("%c", &Suit[i] );
scanf("%c", &Number[i] );
Order[i] = i;
}
char Suit1[37],Number1[37];
int Order1[37];
for ( i = 0 ; i < n ; i++ ){
Suit1[i] = Suit[i];
Number1[i] = Number[i];
Order1[i] = Order[i];
}
BubbleSort( Suit1, Number1, Order1, n );
for ( i = 0 ; i < n ; i++ ){
if ( i < n - 1 ) {
printf("%c%c ", Suit1[i], Number1[i] );
} else {
printf("%c%c\n", Suit1[i], Number1[i] );
}
}
if ( is_stable( Suit1, Number1, Order1, n ) == STABLE ){
printf("Stable\n");
} else if ( is_stable( Suit1, Number1, Order1, n ) == NOT_STABLE ){
printf("Not stable\n");
} else {
printf("ERROR\n");
}
SelectionSort( Suit, Number, Order, n );
for ( i = 0 ; i < n ; i++ ){
if ( i < n - 1 ) {
printf("%c%c ", Suit[i], Number[i] );
} else {
printf("%c%c\n", Suit[i], Number[i] );
}
}
if ( is_stable( Suit, Number, Order, n ) == STABLE ){
printf("Stable\n");
} else if ( is_stable( Suit, Number, Order, n ) == NOT_STABLE ){
printf("Not stable\n");
} else {
printf("ERROR\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113367/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113367/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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"%c\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%c \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%c\0A\00", align 1
@str.9 = private unnamed_addr constant [6 x i8] c"ERROR\00", align 1
@str.10 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.11 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @BubbleSort(ptr nocapture noundef %Suit, ptr nocapture noundef %Number, ptr nocapture noundef %Order, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp76 = icmp sgt i32 %n, 0
br i1 %cmp76, label %for.cond1.preheader.lr.ph, label %for.end41
for.cond1.preheader.lr.ph: ; preds = %entry
%j.072 = add nsw i32 %n, -1
%0 = zext i32 %n to i64
%1 = add nsw i64 %0, -1
%2 = zext i32 %j.072 to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc40
%indvars.iv84 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next85, %for.inc40 ]
%cmp273 = icmp ult i64 %indvars.iv84, %2
br i1 %cmp273, label %for.body3, label %for.inc40
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.inc ], [ %0, %for.cond1.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond1.preheader ]
%indvars.iv.next79 = add nsw i64 %indvars.iv78, -1
%arrayidx = getelementptr inbounds i8, ptr %Number, i64 %indvars.iv
%3 = load i8, ptr %arrayidx, align 1, !tbaa !5
%4 = add nsw i64 %indvars.iv78, -2
%arrayidx6 = getelementptr inbounds i8, ptr %Number, i64 %4
%5 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%cmp8 = icmp slt i8 %3, %5
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx11 = getelementptr inbounds i8, ptr %Suit, i64 %indvars.iv
%6 = load i8, ptr %arrayidx11, align 1, !tbaa !5
%arrayidx14 = getelementptr inbounds i8, ptr %Suit, i64 %4
%7 = load i8, ptr %arrayidx14, align 1, !tbaa !5
store i8 %7, ptr %arrayidx11, align 1, !tbaa !5
store i8 %6, ptr %arrayidx14, align 1, !tbaa !5
%8 = load i8, ptr %arrayidx, align 1, !tbaa !5
%9 = load i8, ptr %arrayidx6, align 1, !tbaa !5
store i8 %9, ptr %arrayidx, align 1, !tbaa !5
store i8 %8, ptr %arrayidx6, align 1, !tbaa !5
%arrayidx31 = getelementptr inbounds i32, ptr %Order, i64 %indvars.iv
%10 = load i32, ptr %arrayidx31, align 4, !tbaa !8
%arrayidx34 = getelementptr inbounds i32, ptr %Order, i64 %4
%11 = load i32, ptr %arrayidx34, align 4, !tbaa !8
store i32 %11, ptr %arrayidx31, align 4, !tbaa !8
store i32 %10, ptr %arrayidx34, align 4, !tbaa !8
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp2 = icmp sgt i64 %indvars.iv.next, %indvars.iv84
br i1 %cmp2, label %for.body3, label %for.inc40, !llvm.loop !10
for.inc40: ; preds = %for.inc, %for.cond1.preheader
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%exitcond.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count
br i1 %exitcond.not, label %for.end41, label %for.cond1.preheader, !llvm.loop !12
for.end41: ; preds = %for.inc40, %entry
ret i32 0
}
; 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 @SelectionSort(ptr nocapture noundef %Suit, ptr nocapture noundef %Number, ptr nocapture noundef %Order, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp69 = icmp sgt i32 %n, 0
br i1 %cmp69, label %for.cond1.preheader.preheader, label %for.end35
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv71 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next72, %for.body3 ]
%minj.068 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%arrayidx = getelementptr inbounds i8, ptr %Number, i64 %indvars.iv71
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
%idxprom4 = sext i32 %minj.068 to i64
%arrayidx5 = getelementptr inbounds i8, ptr %Number, i64 %idxprom4
%3 = load i8, ptr %arrayidx5, align 1, !tbaa !5
%cmp7 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv71 to i32
%spec.select = select i1 %cmp7, i32 %4, i32 %minj.068
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%cmp2 = icmp ult i64 %indvars.iv.next72, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body3
%arrayidx10 = getelementptr inbounds i8, ptr %Suit, i64 %indvars.iv
%5 = load i8, ptr %arrayidx10, align 1, !tbaa !5
%idxprom11 = sext i32 %spec.select to i64
%arrayidx12 = getelementptr inbounds i8, ptr %Suit, i64 %idxprom11
%6 = load i8, ptr %arrayidx12, align 1, !tbaa !5
store i8 %6, ptr %arrayidx10, align 1, !tbaa !5
store i8 %5, ptr %arrayidx12, align 1, !tbaa !5
%arrayidx18 = getelementptr inbounds i8, ptr %Number, i64 %indvars.iv
%7 = load i8, ptr %arrayidx18, align 1, !tbaa !5
%arrayidx20 = getelementptr inbounds i8, ptr %Number, i64 %idxprom11
%8 = load i8, ptr %arrayidx20, align 1, !tbaa !5
store i8 %8, ptr %arrayidx18, align 1, !tbaa !5
store i8 %7, ptr %arrayidx20, align 1, !tbaa !5
%arrayidx26 = getelementptr inbounds i32, ptr %Order, i64 %indvars.iv
%9 = load i32, ptr %arrayidx26, align 4, !tbaa !8
%arrayidx28 = getelementptr inbounds i32, ptr %Order, i64 %idxprom11
%10 = load i32, ptr %arrayidx28, align 4, !tbaa !8
store i32 %10, ptr %arrayidx26, align 4, !tbaa !8
store i32 %9, ptr %arrayidx28, align 4, !tbaa !8
%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.end35, label %for.cond1.preheader, !llvm.loop !14
for.end35: ; preds = %for.end, %entry
ret i32 0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @is_stable(ptr nocapture noundef readnone %Suit, ptr nocapture noundef readonly %Number, ptr nocapture noundef readonly %Order, i32 noundef %n) local_unnamed_addr #2 {
entry:
%cmp20 = icmp sgt i32 %n, 1
br i1 %cmp20, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
%wide.trip.count = zext i32 %sub to i64
%.pre = load i8, ptr %Number, align 1, !tbaa !5
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%0 = phi i8 [ %.pre, %for.body.preheader ], [ %1, %for.inc ]
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx2 = getelementptr inbounds i8, ptr %Number, i64 %indvars.iv.next
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp4 = icmp eq i8 %0, %1
br i1 %cmp4, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%arrayidx7 = getelementptr inbounds i32, ptr %Order, i64 %indvars.iv
%2 = load i32, ptr %arrayidx7, align 4, !tbaa !8
%arrayidx10 = getelementptr inbounds i32, ptr %Order, i64 %indvars.iv.next
%3 = load i32, ptr %arrayidx10, align 4, !tbaa !8
%cmp11 = icmp sgt i32 %2, %3
br i1 %cmp11, label %cleanup, label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !15
cleanup: ; preds = %land.lhs.true, %for.inc, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.inc ], [ 0, %land.lhs.true ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%Suit = alloca [37 x i8], align 16
%Number = alloca [37 x i8], align 16
%c = alloca i8, align 1
%Order = alloca [37 x i32], align 16
%Suit1 = alloca [37 x i8], align 16
%Number1 = alloca [37 x i8], align 16
%Order1 = alloca [37 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 37, ptr nonnull %Suit) #7
call void @llvm.lifetime.start.p0(i64 37, ptr nonnull %Number) #7
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #7
call void @llvm.lifetime.start.p0(i64 148, ptr nonnull %Order) #7
%0 = load i32, ptr %n, align 4, !tbaa !8
%cmp235 = icmp sgt i32 %0, 0
br i1 %cmp235, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 37, ptr nonnull %Suit1) #7
call void @llvm.lifetime.start.p0(i64 37, ptr nonnull %Number1) #7
call void @llvm.lifetime.start.p0(i64 148, ptr nonnull %Order1) #7
br label %if.end69
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c)
%arrayidx = getelementptr inbounds [37 x i8], ptr %Suit, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%arrayidx4 = getelementptr inbounds [37 x i8], ptr %Number, i64 0, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx4)
%arrayidx7 = getelementptr inbounds [37 x i32], ptr %Order, i64 0, i64 %indvars.iv
%1 = trunc i64 %indvars.iv to i32
store i32 %1, ptr %arrayidx7, align 4, !tbaa !8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !8
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !16
for.end: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 37, ptr nonnull %Suit1) #7
call void @llvm.lifetime.start.p0(i64 37, ptr nonnull %Number1) #7
call void @llvm.lifetime.start.p0(i64 148, ptr nonnull %Order1) #7
%cmp9237 = icmp sgt i32 %2, 0
br i1 %cmp9237, label %for.cond1.preheader.lr.ph.i, label %if.end69
for.cond1.preheader.lr.ph.i: ; preds = %for.end
%4 = zext i32 %2 to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %Suit1, ptr nonnull align 16 %Suit, i64 %4, i1 false), !tbaa !5
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %Number1, ptr nonnull align 16 %Number, i64 %4, i1 false), !tbaa !5
%5 = shl nuw nsw i64 %4, 2
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %Order1, ptr nonnull align 16 %Order, i64 %5, i1 false), !tbaa !8
%j.072.i = add nsw i32 %2, -1
%6 = zext i32 %2 to i64
%7 = add nsw i64 %6, -1
%8 = zext i32 %j.072.i to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc40.i, %for.cond1.preheader.lr.ph.i
%indvars.iv84.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next85.i, %for.inc40.i ]
%cmp273.i = icmp ult i64 %indvars.iv84.i, %8
br i1 %cmp273.i, label %for.body3.i, label %for.inc40.i
for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv78.i = phi i64 [ %indvars.iv.next79.i, %for.inc.i ], [ %6, %for.cond1.preheader.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %7, %for.cond1.preheader.i ]
%indvars.iv.next79.i = add nsw i64 %indvars.iv78.i, -1
%arrayidx.i = getelementptr inbounds i8, ptr %Number1, i64 %indvars.iv.i
%9 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%10 = add nsw i64 %indvars.iv78.i, -2
%arrayidx6.i = getelementptr inbounds i8, ptr %Number1, i64 %10
%11 = load i8, ptr %arrayidx6.i, align 1, !tbaa !5
%cmp8.i = icmp slt i8 %9, %11
br i1 %cmp8.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx11.i = getelementptr inbounds i8, ptr %Suit1, i64 %indvars.iv.i
%12 = load i8, ptr %arrayidx11.i, align 1, !tbaa !5
%arrayidx14.i = getelementptr inbounds i8, ptr %Suit1, i64 %10
%13 = load i8, ptr %arrayidx14.i, align 1, !tbaa !5
store i8 %13, ptr %arrayidx11.i, align 1, !tbaa !5
store i8 %12, ptr %arrayidx14.i, align 1, !tbaa !5
store i8 %11, ptr %arrayidx.i, align 1, !tbaa !5
store i8 %9, ptr %arrayidx6.i, align 1, !tbaa !5
%arrayidx31.i = getelementptr inbounds i32, ptr %Order1, i64 %indvars.iv.i
%14 = load i32, ptr %arrayidx31.i, align 4, !tbaa !8
%arrayidx34.i = getelementptr inbounds i32, ptr %Order1, i64 %10
%15 = load i32, ptr %arrayidx34.i, align 4, !tbaa !8
store i32 %15, ptr %arrayidx31.i, align 4, !tbaa !8
store i32 %14, ptr %arrayidx34.i, align 4, !tbaa !8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%cmp2.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv84.i
br i1 %cmp2.i, label %for.body3.i, label %for.inc40.i, !llvm.loop !10
for.inc40.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.next85.i = add nuw nsw i64 %indvars.iv84.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next85.i, %6
br i1 %exitcond.not.i, label %BubbleSort.exit, label %for.cond1.preheader.i, !llvm.loop !12
BubbleSort.exit: ; preds = %for.inc40.i
br i1 %cmp9237, label %for.body31, label %for.end48
for.body31: ; preds = %BubbleSort.exit, %for.body31
%indvars.iv252 = phi i64 [ %indvars.iv.next253, %for.body31 ], [ 0, %BubbleSort.exit ]
%16 = phi i32 [ %20, %for.body31 ], [ %2, %BubbleSort.exit ]
%sub = add nsw i32 %16, -1
%17 = sext i32 %sub to i64
%cmp32 = icmp slt i64 %indvars.iv252, %17
%arrayidx34 = getelementptr inbounds [37 x i8], ptr %Suit1, i64 0, i64 %indvars.iv252
%18 = load i8, ptr %arrayidx34, align 1, !tbaa !5
%conv = sext i8 %18 to i32
%arrayidx36 = getelementptr inbounds [37 x i8], ptr %Number1, i64 0, i64 %indvars.iv252
%19 = load i8, ptr %arrayidx36, align 1, !tbaa !5
%conv37 = sext i8 %19 to i32
%.str.2..str.3 = select i1 %cmp32, ptr @.str.2, ptr @.str.3
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3, i32 noundef %conv, i32 noundef %conv37)
%indvars.iv.next253 = add nuw nsw i64 %indvars.iv252, 1
%20 = load i32, ptr %n, align 4, !tbaa !8
%21 = sext i32 %20 to i64
%cmp30 = icmp slt i64 %indvars.iv.next253, %21
br i1 %cmp30, label %for.body31, label %for.end48, !llvm.loop !17
for.end48: ; preds = %for.body31, %BubbleSort.exit
%.lcssa233 = phi i32 [ %2, %BubbleSort.exit ], [ %20, %for.body31 ]
%cmp20.i = icmp sgt i32 %.lcssa233, 1
br i1 %cmp20.i, label %for.body.preheader.i, label %if.end69
for.body.preheader.i: ; preds = %for.end48
%sub.i = add nsw i32 %.lcssa233, -1
%wide.trip.count.i157 = zext i32 %sub.i to i64
%.pre.i = load i8, ptr %Number1, align 16, !tbaa !5
br label %for.body.i
for.body.i: ; preds = %for.inc.i160, %for.body.preheader.i
%22 = phi i8 [ %.pre.i, %for.body.preheader.i ], [ %23, %for.inc.i160 ]
%indvars.iv.i158 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i159, %for.inc.i160 ]
%indvars.iv.next.i159 = add nuw nsw i64 %indvars.iv.i158, 1
%arrayidx2.i = getelementptr inbounds i8, ptr %Number1, i64 %indvars.iv.next.i159
%23 = load i8, ptr %arrayidx2.i, align 1, !tbaa !5
%cmp4.i = icmp eq i8 %22, %23
br i1 %cmp4.i, label %land.lhs.true.i, label %for.inc.i160
land.lhs.true.i: ; preds = %for.body.i
%arrayidx7.i = getelementptr inbounds i32, ptr %Order1, i64 %indvars.iv.i158
%24 = load i32, ptr %arrayidx7.i, align 4, !tbaa !8
%arrayidx10.i = getelementptr inbounds i32, ptr %Order1, i64 %indvars.iv.next.i159
%25 = load i32, ptr %arrayidx10.i, align 4, !tbaa !8
%cmp11.i = icmp sgt i32 %24, %25
br i1 %cmp11.i, label %for.body.i168, label %for.inc.i160
for.inc.i160: ; preds = %land.lhs.true.i, %for.body.i
%exitcond.not.i161 = icmp eq i64 %indvars.iv.next.i159, %wide.trip.count.i157
br i1 %exitcond.not.i161, label %if.end69, label %for.body.i, !llvm.loop !15
for.body.i168: ; preds = %land.lhs.true.i, %for.inc.i173
%26 = phi i8 [ %27, %for.inc.i173 ], [ %.pre.i, %land.lhs.true.i ]
%indvars.iv.i169 = phi i64 [ %indvars.iv.next.i170, %for.inc.i173 ], [ 0, %land.lhs.true.i ]
%indvars.iv.next.i170 = add nuw nsw i64 %indvars.iv.i169, 1
%arrayidx2.i171 = getelementptr inbounds i8, ptr %Number1, i64 %indvars.iv.next.i170
%27 = load i8, ptr %arrayidx2.i171, align 1, !tbaa !5
%cmp4.i172 = icmp eq i8 %26, %27
br i1 %cmp4.i172, label %land.lhs.true.i175, label %for.inc.i173
land.lhs.true.i175: ; preds = %for.body.i168
%arrayidx7.i176 = getelementptr inbounds i32, ptr %Order1, i64 %indvars.iv.i169
%28 = load i32, ptr %arrayidx7.i176, align 4, !tbaa !8
%arrayidx10.i177 = getelementptr inbounds i32, ptr %Order1, i64 %indvars.iv.next.i170
%29 = load i32, ptr %arrayidx10.i177, align 4, !tbaa !8
%cmp11.i178 = icmp sgt i32 %28, %29
br i1 %cmp11.i178, label %if.end69, label %for.inc.i173
for.inc.i173: ; preds = %land.lhs.true.i175, %for.body.i168
%exitcond.not.i174 = icmp eq i64 %indvars.iv.next.i170, %wide.trip.count.i157
br i1 %exitcond.not.i174, label %if.end69, label %for.body.i168, !llvm.loop !15
if.end69: ; preds = %for.inc.i160, %for.inc.i173, %land.lhs.true.i175, %for.end48, %for.end.thread, %for.end
%str.7.sink = phi ptr [ @str.11, %for.end ], [ @str.11, %for.end.thread ], [ @str.11, %for.end48 ], [ @str.10, %land.lhs.true.i175 ], [ @str.9, %for.inc.i173 ], [ @str.11, %for.inc.i160 ]
%puts152 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
%30 = load i32, ptr %n, align 4, !tbaa !8
%cmp69.i = icmp sgt i32 %30, 0
br i1 %cmp69.i, label %for.cond1.preheader.preheader.i, label %if.end121
for.cond1.preheader.preheader.i: ; preds = %if.end69
%31 = zext i32 %30 to i64
br label %for.cond1.preheader.i181
for.cond1.preheader.i181: ; preds = %for.end.i, %for.cond1.preheader.preheader.i
%indvars.iv.i182 = phi i64 [ 0, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next.i187, %for.end.i ]
%32 = trunc i64 %indvars.iv.i182 to i32
br label %for.body3.i183
for.body3.i183: ; preds = %for.body3.i183, %for.cond1.preheader.i181
%indvars.iv71.i = phi i64 [ %indvars.iv.i182, %for.cond1.preheader.i181 ], [ %indvars.iv.next72.i, %for.body3.i183 ]
%minj.068.i = phi i32 [ %32, %for.cond1.preheader.i181 ], [ %spec.select.i, %for.body3.i183 ]
%arrayidx.i184 = getelementptr inbounds i8, ptr %Number, i64 %indvars.iv71.i
%33 = load i8, ptr %arrayidx.i184, align 1, !tbaa !5
%idxprom4.i = sext i32 %minj.068.i to i64
%arrayidx5.i = getelementptr inbounds i8, ptr %Number, i64 %idxprom4.i
%34 = load i8, ptr %arrayidx5.i, align 1, !tbaa !5
%cmp7.i = icmp slt i8 %33, %34
%35 = trunc i64 %indvars.iv71.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %35, i32 %minj.068.i
%indvars.iv.next72.i = add nuw nsw i64 %indvars.iv71.i, 1
%cmp2.i185 = icmp ult i64 %indvars.iv.next72.i, %31
br i1 %cmp2.i185, label %for.body3.i183, label %for.end.i, !llvm.loop !13
for.end.i: ; preds = %for.body3.i183
%arrayidx10.i186 = getelementptr inbounds i8, ptr %Suit, i64 %indvars.iv.i182
%36 = load i8, ptr %arrayidx10.i186, align 1, !tbaa !5
%idxprom11.i = sext i32 %spec.select.i to i64
%arrayidx12.i = getelementptr inbounds i8, ptr %Suit, i64 %idxprom11.i
%37 = load i8, ptr %arrayidx12.i, align 1, !tbaa !5
store i8 %37, ptr %arrayidx10.i186, align 1, !tbaa !5
store i8 %36, ptr %arrayidx12.i, align 1, !tbaa !5
%arrayidx18.i = getelementptr inbounds i8, ptr %Number, i64 %indvars.iv.i182
%38 = load i8, ptr %arrayidx18.i, align 1, !tbaa !5
%arrayidx20.i = getelementptr inbounds i8, ptr %Number, i64 %idxprom11.i
%39 = load i8, ptr %arrayidx20.i, align 1, !tbaa !5
store i8 %39, ptr %arrayidx18.i, align 1, !tbaa !5
store i8 %38, ptr %arrayidx20.i, align 1, !tbaa !5
%arrayidx26.i = getelementptr inbounds i32, ptr %Order, i64 %indvars.iv.i182
%40 = load i32, ptr %arrayidx26.i, align 4, !tbaa !8
%arrayidx28.i = getelementptr inbounds i32, ptr %Order, i64 %idxprom11.i
%41 = load i32, ptr %arrayidx28.i, align 4, !tbaa !8
store i32 %41, ptr %arrayidx26.i, align 4, !tbaa !8
store i32 %40, ptr %arrayidx28.i, align 4, !tbaa !8
%indvars.iv.next.i187 = add nuw nsw i64 %indvars.iv.i182, 1
%exitcond.not.i188 = icmp eq i64 %indvars.iv.next.i187, %31
br i1 %exitcond.not.i188, label %SelectionSort.exit, label %for.cond1.preheader.i181, !llvm.loop !14
SelectionSort.exit: ; preds = %for.end.i
br i1 %cmp69.i, label %for.body77, label %if.end121
for.body77: ; preds = %SelectionSort.exit, %for.body77
%indvars.iv255 = phi i64 [ %indvars.iv.next256, %for.body77 ], [ 0, %SelectionSort.exit ]
%42 = phi i32 [ %46, %for.body77 ], [ %30, %SelectionSort.exit ]
%sub78 = add nsw i32 %42, -1
%43 = sext i32 %sub78 to i64
%cmp79 = icmp slt i64 %indvars.iv255, %43
%arrayidx83 = getelementptr inbounds [37 x i8], ptr %Suit, i64 0, i64 %indvars.iv255
%44 = load i8, ptr %arrayidx83, align 1, !tbaa !5
%conv84 = sext i8 %44 to i32
%arrayidx86 = getelementptr inbounds [37 x i8], ptr %Number, i64 0, i64 %indvars.iv255
%45 = load i8, ptr %arrayidx86, align 1, !tbaa !5
%conv87 = sext i8 %45 to i32
%.str.2..str.3270 = select i1 %cmp79, ptr @.str.2, ptr @.str.3
%call88 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3270, i32 noundef %conv84, i32 noundef %conv87)
%indvars.iv.next256 = add nuw nsw i64 %indvars.iv255, 1
%46 = load i32, ptr %n, align 4, !tbaa !8
%47 = sext i32 %46 to i64
%cmp75 = icmp slt i64 %indvars.iv.next256, %47
br i1 %cmp75, label %for.body77, label %for.end100, !llvm.loop !18
for.end100: ; preds = %for.body77
%cmp20.i189 = icmp sgt i32 %46, 1
br i1 %cmp20.i189, label %for.body.preheader.i191, label %if.end121
for.body.preheader.i191: ; preds = %for.end100
%sub.i192 = add nsw i32 %46, -1
%wide.trip.count.i193 = zext i32 %sub.i192 to i64
%.pre.i194 = load i8, ptr %Number, align 16, !tbaa !5
br label %for.body.i195
for.body.i195: ; preds = %for.inc.i200, %for.body.preheader.i191
%48 = phi i8 [ %.pre.i194, %for.body.preheader.i191 ], [ %49, %for.inc.i200 ]
%indvars.iv.i196 = phi i64 [ 0, %for.body.preheader.i191 ], [ %indvars.iv.next.i197, %for.inc.i200 ]
%indvars.iv.next.i197 = add nuw nsw i64 %indvars.iv.i196, 1
%arrayidx2.i198 = getelementptr inbounds i8, ptr %Number, i64 %indvars.iv.next.i197
%49 = load i8, ptr %arrayidx2.i198, align 1, !tbaa !5
%cmp4.i199 = icmp eq i8 %48, %49
br i1 %cmp4.i199, label %land.lhs.true.i202, label %for.inc.i200
land.lhs.true.i202: ; preds = %for.body.i195
%arrayidx7.i203 = getelementptr inbounds i32, ptr %Order, i64 %indvars.iv.i196
%50 = load i32, ptr %arrayidx7.i203, align 4, !tbaa !8
%arrayidx10.i204 = getelementptr inbounds i32, ptr %Order, i64 %indvars.iv.next.i197
%51 = load i32, ptr %arrayidx10.i204, align 4, !tbaa !8
%cmp11.i205 = icmp sgt i32 %50, %51
br i1 %cmp11.i205, label %for.body.i213, label %for.inc.i200
for.inc.i200: ; preds = %land.lhs.true.i202, %for.body.i195
%exitcond.not.i201 = icmp eq i64 %indvars.iv.next.i197, %wide.trip.count.i193
br i1 %exitcond.not.i201, label %if.end121, label %for.body.i195, !llvm.loop !15
for.body.i213: ; preds = %land.lhs.true.i202, %for.inc.i218
%52 = phi i8 [ %53, %for.inc.i218 ], [ %.pre.i194, %land.lhs.true.i202 ]
%indvars.iv.i214 = phi i64 [ %indvars.iv.next.i215, %for.inc.i218 ], [ 0, %land.lhs.true.i202 ]
%indvars.iv.next.i215 = add nuw nsw i64 %indvars.iv.i214, 1
%arrayidx2.i216 = getelementptr inbounds i8, ptr %Number, i64 %indvars.iv.next.i215
%53 = load i8, ptr %arrayidx2.i216, align 1, !tbaa !5
%cmp4.i217 = icmp eq i8 %52, %53
br i1 %cmp4.i217, label %land.lhs.true.i220, label %for.inc.i218
land.lhs.true.i220: ; preds = %for.body.i213
%arrayidx7.i221 = getelementptr inbounds i32, ptr %Order, i64 %indvars.iv.i214
%54 = load i32, ptr %arrayidx7.i221, align 4, !tbaa !8
%arrayidx10.i222 = getelementptr inbounds i32, ptr %Order, i64 %indvars.iv.next.i215
%55 = load i32, ptr %arrayidx10.i222, align 4, !tbaa !8
%cmp11.i223 = icmp sgt i32 %54, %55
br i1 %cmp11.i223, label %if.end121, label %for.inc.i218
for.inc.i218: ; preds = %land.lhs.true.i220, %for.body.i213
%exitcond.not.i219 = icmp eq i64 %indvars.iv.next.i215, %wide.trip.count.i193
br i1 %exitcond.not.i219, label %if.end121, label %for.body.i213, !llvm.loop !15
if.end121: ; preds = %for.inc.i200, %for.inc.i218, %land.lhs.true.i220, %for.end100, %SelectionSort.exit, %if.end69
%str.10.sink = phi ptr [ @str.11, %if.end69 ], [ @str.11, %SelectionSort.exit ], [ @str.11, %for.end100 ], [ @str.10, %land.lhs.true.i220 ], [ @str.9, %for.inc.i218 ], [ @str.11, %for.inc.i200 ]
%puts155 = call i32 @puts(ptr nonnull dereferenceable(1) %str.10.sink)
call void @llvm.lifetime.end.p0(i64 148, ptr nonnull %Order1) #7
call void @llvm.lifetime.end.p0(i64 37, ptr nonnull %Number1) #7
call void @llvm.lifetime.end.p0(i64 37, ptr nonnull %Suit1) #7
call void @llvm.lifetime.end.p0(i64 148, ptr nonnull %Order) #7
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #7
call void @llvm.lifetime.end.p0(i64 37, ptr nonnull %Number) #7
call void @llvm.lifetime.end.p0(i64 37, ptr nonnull %Suit) #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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
|
#include <stdio.h>
int main() {
long long int t, n;
scanf("%lld", &t);
while(t--) {
scanf("%lld", &n);
printf("%lld\n", (n - 1)/2 + 1);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11341/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11341/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i64, align 8
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i64, ptr %t, align 8, !tbaa !5
%dec3 = add nsw i64 %0, -1
store i64 %dec3, ptr %t, align 8, !tbaa !5
%tobool.not4 = icmp eq i64 %0, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i64, ptr %n, align 8, !tbaa !5
%sub = add nsw i64 %1, -1
%div = sdiv i64 %sub, 2
%add = add nsw i64 %div, 1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add)
%2 = load i64, ptr %t, align 8, !tbaa !5
%dec = add nsw i64 %2, -1
store i64 %dec, ptr %t, align 8, !tbaa !5
%tobool.not = icmp eq i64 %2, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#define N 10000
typedef struct {
char name;
int value;
}Card;
void Bubble(Card c[],int n){
Card swap;
int i,j;
for(i=0; i<=n-1; i++) {
for(j=n-1; j>=i+1; j--) {
if(c[j].value<c[j-1].value) {
swap=c[j];
c[j]=c[j-1];
c[j-1] =swap;
}
}
}
for(i=0; i<n-1; i++) {
printf("%c%d ",c[i].name,c[i].value);
}
printf("%c%d",c[i].name,c[i].value);
printf("\n");
}
void Selection(Card c[],int n){
Card swap;
int i,j;
int minj;
for(i=0; i<n; i++) {
minj=i;
for(j=i+1; j<n; j++) {
if(c[j].value<c[minj].value) {
minj=j;
}
}
swap=c[i];
c[i]=c[minj];
c[minj] =swap;
}
for(i=0; i<n-1; i++) {
printf("%c%d ",c[i].name,c[i].value);
}
printf("%c%d",c[i].name,c[i].value);
printf("\n");
}
int isStable(Card A[],Card B[],int n){
int flug=0,i;
for(i=0; i<n; i++) {
if(A[i].name!=B[i].name) {
flug++;
}
}
if(flug==0) return 1;
else return 0;
}
int main(){
int i,n;
Card A[N],B[N];
scanf("%d",&n);
for(i=0; i<n; i++) {
scanf("%c%c%d",&A[i].name,&A[i].name,&A[i].value);
B[i]=A[i];
}
Bubble(A, n);
printf("Stable\n");
Selection(B, n);
if(isStable(A,B,n)) {
printf("Stable\n");
}
else {
printf("Not stable\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113453/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113453/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Card = type { i8, i32 }
@.str = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [7 x i8] c"%c%c%d\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @Bubble(ptr nocapture noundef %c, i32 noundef %n) local_unnamed_addr #0 {
entry:
%sub = add i32 %n, -1
%cmp.not.not71 = icmp sgt i32 %n, 0
br i1 %cmp.not.not71, label %for.cond2.preheader.preheader, label %for.end33
for.cond2.preheader.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%1 = add nsw i64 %0, -1
%2 = zext i32 %sub to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.inc20
%indvars.iv77 = phi i64 [ 0, %for.cond2.preheader.preheader ], [ %indvars.iv.next78, %for.inc20 ]
%cmp3.not.not69 = icmp ult i64 %indvars.iv77, %2
br i1 %cmp3.not.not69, label %for.body4, label %for.inc20
for.cond22.preheader: ; preds = %for.inc20
%cmp2473 = icmp sgt i32 %n, 1
br i1 %cmp2473, label %for.body25.preheader, label %for.end33
for.body25.preheader: ; preds = %for.cond22.preheader
%wide.trip.count83 = zext i32 %sub to i64
br label %for.body25
for.body4: ; preds = %for.cond2.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond2.preheader ]
%value = getelementptr inbounds %struct.Card, ptr %c, i64 %indvars.iv, i32 1
%3 = load i32, ptr %value, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value8 = getelementptr inbounds %struct.Card, ptr %c, i64 %indvars.iv.next, i32 1
%4 = load i32, ptr %value8, align 4, !tbaa !5
%cmp9 = icmp slt i32 %3, %4
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body4
%arrayidx7 = getelementptr inbounds %struct.Card, ptr %c, i64 %indvars.iv.next
%5 = load <2 x i64>, ptr %arrayidx7, align 4
%6 = shufflevector <2 x i64> %5, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %6, ptr %arrayidx7, align 4
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%cmp3.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv77
br i1 %cmp3.not.not, label %for.body4, label %for.inc20, !llvm.loop !10
for.inc20: ; preds = %for.inc, %for.cond2.preheader
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%exitcond.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count
br i1 %exitcond.not, label %for.cond22.preheader, label %for.cond2.preheader, !llvm.loop !12
for.body25: ; preds = %for.body25.preheader, %for.body25
%indvars.iv80 = phi i64 [ 0, %for.body25.preheader ], [ %indvars.iv.next81, %for.body25 ]
%arrayidx27 = getelementptr inbounds %struct.Card, ptr %c, i64 %indvars.iv80
%7 = load i8, ptr %arrayidx27, align 4, !tbaa !13
%conv = sext i8 %7 to i32
%value30 = getelementptr inbounds %struct.Card, ptr %c, i64 %indvars.iv80, i32 1
%8 = load i32, ptr %value30, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv, i32 noundef %8)
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%exitcond84.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count83
br i1 %exitcond84.not, label %for.end33.loopexit, label %for.body25, !llvm.loop !14
for.end33.loopexit: ; preds = %for.body25
%9 = zext i32 %sub to i64
br label %for.end33
for.end33: ; preds = %entry, %for.cond22.preheader, %for.end33.loopexit
%i.1.lcssa = phi i64 [ %9, %for.end33.loopexit ], [ 0, %for.cond22.preheader ], [ 0, %entry ]
%arrayidx35 = getelementptr inbounds %struct.Card, ptr %c, i64 %i.1.lcssa
%10 = load i8, ptr %arrayidx35, align 4, !tbaa !13
%conv37 = sext i8 %10 to i32
%value40 = getelementptr inbounds %struct.Card, ptr %c, i64 %i.1.lcssa, i32 1
%11 = load i32, ptr %value40, align 4, !tbaa !5
%call41 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv37, i32 noundef %11)
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @Selection(ptr nocapture noundef %c, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp69 = icmp sgt i32 %n, 0
br i1 %cmp69, label %for.body.preheader, label %for.end29
for.body.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count80 = zext i32 %n to i64
br label %for.body
for.cond19.preheader: ; preds = %for.end
%sub = add i32 %n, -1
%cmp2071 = icmp sgt i32 %n, 1
br i1 %cmp2071, label %for.body21.preheader, label %for.end29
for.body21.preheader: ; preds = %for.cond19.preheader
%wide.trip.count85 = zext i32 %sub to i64
br label %for.body21
for.body: ; preds = %for.body.preheader, %for.end
%indvars.iv77 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next78, %for.end ]
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.end ]
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%cmp266 = icmp ult i64 %indvars.iv.next78, %0
%1 = trunc i64 %indvars.iv77 to i32
br i1 %cmp266, label %for.body3, label %for.end
for.body3: ; preds = %for.body, %for.body3
%indvars.iv74 = phi i64 [ %indvars.iv.next75, %for.body3 ], [ %indvars.iv, %for.body ]
%minj.068 = phi i32 [ %spec.select, %for.body3 ], [ %1, %for.body ]
%value = getelementptr inbounds %struct.Card, ptr %c, i64 %indvars.iv74, i32 1
%2 = load i32, ptr %value, align 4, !tbaa !5
%idxprom4 = sext i32 %minj.068 to i64
%value6 = getelementptr inbounds %struct.Card, ptr %c, i64 %idxprom4, i32 1
%3 = load i32, ptr %value6, align 4, !tbaa !5
%cmp7 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv74 to i32
%spec.select = select i1 %cmp7, i32 %4, i32 %minj.068
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%exitcond.not = icmp eq i64 %indvars.iv.next75, %wide.trip.count80
br i1 %exitcond.not, label %for.end, label %for.body3, !llvm.loop !15
for.end: ; preds = %for.body3, %for.body
%minj.0.lcssa = phi i32 [ %1, %for.body ], [ %spec.select, %for.body3 ]
%arrayidx9 = getelementptr inbounds %struct.Card, ptr %c, i64 %indvars.iv77
%5 = load i64, ptr %arrayidx9, align 4
%idxprom12 = sext i32 %minj.0.lcssa to i64
%arrayidx13 = getelementptr inbounds %struct.Card, ptr %c, i64 %idxprom12
%6 = load i64, ptr %arrayidx13, align 4
store i64 %6, ptr %arrayidx9, align 4
store i64 %5, ptr %arrayidx13, align 4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond81.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count80
br i1 %exitcond81.not, label %for.cond19.preheader, label %for.body, !llvm.loop !16
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv82 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next83, %for.body21 ]
%arrayidx23 = getelementptr inbounds %struct.Card, ptr %c, i64 %indvars.iv82
%7 = load i8, ptr %arrayidx23, align 4, !tbaa !13
%conv = sext i8 %7 to i32
%value26 = getelementptr inbounds %struct.Card, ptr %c, i64 %indvars.iv82, i32 1
%8 = load i32, ptr %value26, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv, i32 noundef %8)
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%exitcond86.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count85
br i1 %exitcond86.not, label %for.end29.loopexit, label %for.body21, !llvm.loop !17
for.end29.loopexit: ; preds = %for.body21
%9 = zext i32 %sub to i64
br label %for.end29
for.end29: ; preds = %entry, %for.cond19.preheader, %for.end29.loopexit
%i.1.lcssa = phi i64 [ %9, %for.end29.loopexit ], [ 0, %for.cond19.preheader ], [ 0, %entry ]
%arrayidx31 = getelementptr inbounds %struct.Card, ptr %c, i64 %i.1.lcssa
%10 = load i8, ptr %arrayidx31, align 4, !tbaa !13
%conv33 = sext i8 %10 to i32
%value36 = getelementptr inbounds %struct.Card, ptr %c, i64 %i.1.lcssa, i32 1
%11 = load i32, ptr %value36, align 4, !tbaa !5
%call37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv33, i32 noundef %11)
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %A, ptr nocapture noundef readonly %B, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp16 = icmp sgt i32 %n, 0
br i1 %cmp16, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%xtraiter = and i64 %wide.trip.count, 3
%0 = icmp ult i32 %n, 4
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%flug.017 = phi i32 [ 0, %for.body.preheader.new ], [ %spec.select.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 4, !tbaa !13
%arrayidx2 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv
%2 = load i8, ptr %arrayidx2, align 4, !tbaa !13
%cmp5.not = icmp ne i8 %1, %2
%inc = zext i1 %cmp5.not to i32
%spec.select = add nuw nsw i32 %flug.017, %inc
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx.1, align 4, !tbaa !13
%arrayidx2.1 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx2.1, align 4, !tbaa !13
%cmp5.not.1 = icmp ne i8 %3, %4
%inc.1 = zext i1 %cmp5.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc.1
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next.1
%5 = load i8, ptr %arrayidx.2, align 4, !tbaa !13
%arrayidx2.2 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.next.1
%6 = load i8, ptr %arrayidx2.2, align 4, !tbaa !13
%cmp5.not.2 = icmp ne i8 %5, %6
%inc.2 = zext i1 %cmp5.not.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc.2
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next.2
%7 = load i8, ptr %arrayidx.3, align 4, !tbaa !13
%arrayidx2.3 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.next.2
%8 = load i8, ptr %arrayidx2.3, align 4, !tbaa !13
%cmp5.not.3 = icmp ne i8 %7, %8
%inc.3 = zext i1 %cmp5.not.3 to i32
%spec.select.3 = add nuw nsw i32 %spec.select.2, %inc.3
%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 !18
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %spec.select.3, %for.body ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%flug.017.unr = phi i32 [ 0, %for.body.preheader ], [ %spec.select.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end.loopexit, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ]
%flug.017.epil = phi i32 [ %spec.select.epil, %for.body.epil ], [ %flug.017.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.epil
%9 = load i8, ptr %arrayidx.epil, align 4, !tbaa !13
%arrayidx2.epil = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.epil
%10 = load i8, ptr %arrayidx2.epil, align 4, !tbaa !13
%cmp5.not.epil = icmp ne i8 %9, %10
%inc.epil = zext i1 %cmp5.not.epil to i32
%spec.select.epil = add nuw nsw i32 %flug.017.epil, %inc.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.loopexit, label %for.body.epil, !llvm.loop !19
for.end.loopexit: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa
%spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body.epil ]
%11 = icmp eq i32 %spec.select.lcssa, 0
%12 = zext i1 %11 to i32
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%flug.0.lcssa = phi i32 [ 1, %entry ], [ %12, %for.end.loopexit ]
ret i32 %flug.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%A = alloca [10000 x %struct.Card], align 16
%B = alloca [10000 x %struct.Card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %B) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !21
%cmp48 = icmp sgt i32 %0, 0
br i1 %cmp48, label %for.body, label %Bubble.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x %struct.Card], ptr %A, i64 0, i64 %indvars.iv
%value = getelementptr inbounds [10000 x %struct.Card], ptr %A, i64 0, i64 %indvars.iv, i32 1
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx, ptr noundef nonnull %value)
%arrayidx8 = getelementptr inbounds [10000 x %struct.Card], ptr %B, i64 0, i64 %indvars.iv
%1 = load i64, ptr %arrayidx, align 8
store i64 %1, ptr %arrayidx8, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !21
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !22
for.end: ; preds = %for.body
%cmp.not.not71.i = icmp sgt i32 %2, 0
br i1 %cmp.not.not71.i, label %for.cond2.preheader.preheader.i, label %Bubble.exit
for.cond2.preheader.preheader.i: ; preds = %for.end
%sub.i = add nsw i32 %2, -1
%4 = zext i32 %2 to i64
%5 = add nsw i64 %4, -1
%6 = zext i32 %sub.i to i64
br label %for.cond2.preheader.i
for.cond2.preheader.i: ; preds = %for.inc20.i, %for.cond2.preheader.preheader.i
%indvars.iv77.i = phi i64 [ 0, %for.cond2.preheader.preheader.i ], [ %indvars.iv.next78.i, %for.inc20.i ]
%cmp3.not.not69.i = icmp ult i64 %indvars.iv77.i, %6
br i1 %cmp3.not.not69.i, label %for.body4.i, label %for.inc20.i
for.cond22.preheader.i: ; preds = %for.inc20.i
%cmp2473.i = icmp sgt i32 %2, 1
br i1 %cmp2473.i, label %for.body25.i, label %Bubble.exit
for.body4.i: ; preds = %for.cond2.preheader.i, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %5, %for.cond2.preheader.i ]
%value.i = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.i, i32 1
%7 = load i32, ptr %value.i, align 4, !tbaa !5
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value8.i = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next.i, i32 1
%8 = load i32, ptr %value8.i, align 4, !tbaa !5
%cmp9.i = icmp slt i32 %7, %8
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i
%arrayidx7.i = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next.i
%9 = load <2 x i64>, ptr %arrayidx7.i, align 8
%10 = shufflevector <2 x i64> %9, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %10, ptr %arrayidx7.i, align 8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i
%cmp3.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv77.i
br i1 %cmp3.not.not.i, label %for.body4.i, label %for.inc20.i, !llvm.loop !10
for.inc20.i: ; preds = %for.inc.i, %for.cond2.preheader.i
%indvars.iv.next78.i = add nuw nsw i64 %indvars.iv77.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next78.i, %4
br i1 %exitcond.not.i, label %for.cond22.preheader.i, label %for.cond2.preheader.i, !llvm.loop !12
for.body25.i: ; preds = %for.cond22.preheader.i, %for.body25.i
%indvars.iv80.i = phi i64 [ %indvars.iv.next81.i, %for.body25.i ], [ 0, %for.cond22.preheader.i ]
%arrayidx27.i = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv80.i
%11 = load i8, ptr %arrayidx27.i, align 8, !tbaa !13
%conv.i = sext i8 %11 to i32
%value30.i = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv80.i, i32 1
%12 = load i32, ptr %value30.i, align 4, !tbaa !5
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv.i, i32 noundef %12)
%indvars.iv.next81.i = add nuw nsw i64 %indvars.iv80.i, 1
%exitcond84.not.i = icmp eq i64 %indvars.iv.next81.i, %6
br i1 %exitcond84.not.i, label %Bubble.exit, label %for.body25.i, !llvm.loop !14
Bubble.exit: ; preds = %for.body25.i, %entry, %for.end, %for.cond22.preheader.i
%i.1.lcssa.i = phi i64 [ 0, %for.cond22.preheader.i ], [ 0, %for.end ], [ 0, %entry ], [ %6, %for.body25.i ]
%arrayidx35.i = getelementptr inbounds %struct.Card, ptr %A, i64 %i.1.lcssa.i
%13 = load i8, ptr %arrayidx35.i, align 8, !tbaa !13
%conv37.i = sext i8 %13 to i32
%value40.i = getelementptr inbounds %struct.Card, ptr %A, i64 %i.1.lcssa.i, i32 1
%14 = load i32, ptr %value40.i, align 4, !tbaa !5
%call41.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv37.i, i32 noundef %14)
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%15 = load i32, ptr %n, align 4, !tbaa !21
%cmp69.i = icmp sgt i32 %15, 0
br i1 %cmp69.i, label %for.body.preheader.i, label %Selection.exit
for.body.preheader.i: ; preds = %Bubble.exit
%16 = zext i32 %15 to i64
br label %for.body.i
for.cond19.preheader.i: ; preds = %for.end.i
%cmp2071.i = icmp sgt i32 %15, 1
br i1 %cmp2071.i, label %for.body21.preheader.i, label %Selection.exit
for.body21.preheader.i: ; preds = %for.cond19.preheader.i
%sub.i32 = add nsw i32 %15, -1
%wide.trip.count85.i = zext i32 %sub.i32 to i64
br label %for.body21.i
for.body.i: ; preds = %for.end.i, %for.body.preheader.i
%indvars.iv77.i28 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next78.i30, %for.end.i ]
%indvars.iv.i29 = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i31, %for.end.i ]
%indvars.iv.next78.i30 = add nuw nsw i64 %indvars.iv77.i28, 1
%cmp266.i = icmp ult i64 %indvars.iv.next78.i30, %16
%17 = trunc i64 %indvars.iv77.i28 to i32
br i1 %cmp266.i, label %for.body3.i, label %for.end.i
for.body3.i: ; preds = %for.body.i, %for.body3.i
%indvars.iv74.i = phi i64 [ %indvars.iv.next75.i, %for.body3.i ], [ %indvars.iv.i29, %for.body.i ]
%minj.068.i = phi i32 [ %spec.select.i, %for.body3.i ], [ %17, %for.body.i ]
%value.i35 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv74.i, i32 1
%18 = load i32, ptr %value.i35, align 4, !tbaa !5
%idxprom4.i = sext i32 %minj.068.i to i64
%value6.i = getelementptr inbounds %struct.Card, ptr %B, i64 %idxprom4.i, i32 1
%19 = load i32, ptr %value6.i, align 4, !tbaa !5
%cmp7.i = icmp slt i32 %18, %19
%20 = trunc i64 %indvars.iv74.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %20, i32 %minj.068.i
%indvars.iv.next75.i = add nuw nsw i64 %indvars.iv74.i, 1
%exitcond.not.i36 = icmp eq i64 %indvars.iv.next75.i, %16
br i1 %exitcond.not.i36, label %for.end.i, label %for.body3.i, !llvm.loop !15
for.end.i: ; preds = %for.body3.i, %for.body.i
%minj.0.lcssa.i = phi i32 [ %17, %for.body.i ], [ %spec.select.i, %for.body3.i ]
%arrayidx9.i = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv77.i28
%21 = load i64, ptr %arrayidx9.i, align 8
%idxprom12.i = sext i32 %minj.0.lcssa.i to i64
%arrayidx13.i = getelementptr inbounds %struct.Card, ptr %B, i64 %idxprom12.i
%22 = load i64, ptr %arrayidx13.i, align 8
store i64 %22, ptr %arrayidx9.i, align 8
store i64 %21, ptr %arrayidx13.i, align 8
%indvars.iv.next.i31 = add nuw nsw i64 %indvars.iv.i29, 1
%exitcond81.not.i = icmp eq i64 %indvars.iv.next78.i30, %16
br i1 %exitcond81.not.i, label %for.cond19.preheader.i, label %for.body.i, !llvm.loop !16
for.body21.i: ; preds = %for.body21.i, %for.body21.preheader.i
%indvars.iv82.i = phi i64 [ 0, %for.body21.preheader.i ], [ %indvars.iv.next83.i, %for.body21.i ]
%arrayidx23.i = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv82.i
%23 = load i8, ptr %arrayidx23.i, align 8, !tbaa !13
%conv.i33 = sext i8 %23 to i32
%value26.i = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv82.i, i32 1
%24 = load i32, ptr %value26.i, align 4, !tbaa !5
%call.i34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv.i33, i32 noundef %24)
%indvars.iv.next83.i = add nuw nsw i64 %indvars.iv82.i, 1
%exitcond86.not.i = icmp eq i64 %indvars.iv.next83.i, %wide.trip.count85.i
br i1 %exitcond86.not.i, label %Selection.exit, label %for.body21.i, !llvm.loop !17
Selection.exit: ; preds = %for.body21.i, %Bubble.exit, %for.cond19.preheader.i
%i.1.lcssa.i26 = phi i64 [ 0, %for.cond19.preheader.i ], [ 0, %Bubble.exit ], [ %wide.trip.count85.i, %for.body21.i ]
%arrayidx31.i = getelementptr inbounds %struct.Card, ptr %B, i64 %i.1.lcssa.i26
%25 = load i8, ptr %arrayidx31.i, align 8, !tbaa !13
%conv33.i = sext i8 %25 to i32
%value36.i = getelementptr inbounds %struct.Card, ptr %B, i64 %i.1.lcssa.i26, i32 1
%26 = load i32, ptr %value36.i, align 4, !tbaa !5
%call37.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv33.i, i32 noundef %26)
%putchar.i27 = call i32 @putchar(i32 10)
%27 = load i32, ptr %n, align 4, !tbaa !21
%cmp16.i = icmp sgt i32 %27, 0
br i1 %cmp16.i, label %for.body.preheader.i38, label %if.end
for.body.preheader.i38: ; preds = %Selection.exit
%wide.trip.count.i39 = zext i32 %27 to i64
%xtraiter = and i64 %wide.trip.count.i39, 3
%28 = icmp ult i32 %27, 4
br i1 %28, label %isStable.exit.unr-lcssa, label %for.body.preheader.i38.new
for.body.preheader.i38.new: ; preds = %for.body.preheader.i38
%unroll_iter = and i64 %wide.trip.count.i39, 4294967292
br label %for.body.i40
for.body.i40: ; preds = %for.body.i40, %for.body.preheader.i38.new
%indvars.iv.i41 = phi i64 [ 0, %for.body.preheader.i38.new ], [ %indvars.iv.next.i44.3, %for.body.i40 ]
%flug.017.i = phi i32 [ 0, %for.body.preheader.i38.new ], [ %spec.select.i43.3, %for.body.i40 ]
%niter = phi i64 [ 0, %for.body.preheader.i38.new ], [ %niter.next.3, %for.body.i40 ]
%arrayidx.i42 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.i41
%29 = load i8, ptr %arrayidx.i42, align 16, !tbaa !13
%arrayidx2.i = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.i41
%30 = load i8, ptr %arrayidx2.i, align 16, !tbaa !13
%cmp5.not.i = icmp ne i8 %29, %30
%inc.i = zext i1 %cmp5.not.i to i32
%spec.select.i43 = add nuw nsw i32 %flug.017.i, %inc.i
%indvars.iv.next.i44 = or i64 %indvars.iv.i41, 1
%arrayidx.i42.1 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next.i44
%31 = load i8, ptr %arrayidx.i42.1, align 8, !tbaa !13
%arrayidx2.i.1 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.next.i44
%32 = load i8, ptr %arrayidx2.i.1, align 8, !tbaa !13
%cmp5.not.i.1 = icmp ne i8 %31, %32
%inc.i.1 = zext i1 %cmp5.not.i.1 to i32
%spec.select.i43.1 = add nuw nsw i32 %spec.select.i43, %inc.i.1
%indvars.iv.next.i44.1 = or i64 %indvars.iv.i41, 2
%arrayidx.i42.2 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next.i44.1
%33 = load i8, ptr %arrayidx.i42.2, align 16, !tbaa !13
%arrayidx2.i.2 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.next.i44.1
%34 = load i8, ptr %arrayidx2.i.2, align 16, !tbaa !13
%cmp5.not.i.2 = icmp ne i8 %33, %34
%inc.i.2 = zext i1 %cmp5.not.i.2 to i32
%spec.select.i43.2 = add nuw nsw i32 %spec.select.i43.1, %inc.i.2
%indvars.iv.next.i44.2 = or i64 %indvars.iv.i41, 3
%arrayidx.i42.3 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next.i44.2
%35 = load i8, ptr %arrayidx.i42.3, align 8, !tbaa !13
%arrayidx2.i.3 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.next.i44.2
%36 = load i8, ptr %arrayidx2.i.3, align 8, !tbaa !13
%cmp5.not.i.3 = icmp ne i8 %35, %36
%inc.i.3 = zext i1 %cmp5.not.i.3 to i32
%spec.select.i43.3 = add nuw nsw i32 %spec.select.i43.2, %inc.i.3
%indvars.iv.next.i44.3 = add nuw nsw i64 %indvars.iv.i41, 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 %isStable.exit.unr-lcssa, label %for.body.i40, !llvm.loop !18
isStable.exit.unr-lcssa: ; preds = %for.body.i40, %for.body.preheader.i38
%spec.select.i43.lcssa.ph = phi i32 [ undef, %for.body.preheader.i38 ], [ %spec.select.i43.3, %for.body.i40 ]
%indvars.iv.i41.unr = phi i64 [ 0, %for.body.preheader.i38 ], [ %indvars.iv.next.i44.3, %for.body.i40 ]
%flug.017.i.unr = phi i32 [ 0, %for.body.preheader.i38 ], [ %spec.select.i43.3, %for.body.i40 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %isStable.exit, label %for.body.i40.epil
for.body.i40.epil: ; preds = %isStable.exit.unr-lcssa, %for.body.i40.epil
%indvars.iv.i41.epil = phi i64 [ %indvars.iv.next.i44.epil, %for.body.i40.epil ], [ %indvars.iv.i41.unr, %isStable.exit.unr-lcssa ]
%flug.017.i.epil = phi i32 [ %spec.select.i43.epil, %for.body.i40.epil ], [ %flug.017.i.unr, %isStable.exit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i40.epil ], [ 0, %isStable.exit.unr-lcssa ]
%arrayidx.i42.epil = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.i41.epil
%37 = load i8, ptr %arrayidx.i42.epil, align 8, !tbaa !13
%arrayidx2.i.epil = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.i41.epil
%38 = load i8, ptr %arrayidx2.i.epil, align 8, !tbaa !13
%cmp5.not.i.epil = icmp ne i8 %37, %38
%inc.i.epil = zext i1 %cmp5.not.i.epil to i32
%spec.select.i43.epil = add nuw nsw i32 %flug.017.i.epil, %inc.i.epil
%indvars.iv.next.i44.epil = add nuw nsw i64 %indvars.iv.i41.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 %isStable.exit, label %for.body.i40.epil, !llvm.loop !23
isStable.exit: ; preds = %for.body.i40.epil, %isStable.exit.unr-lcssa
%spec.select.i43.lcssa = phi i32 [ %spec.select.i43.lcssa.ph, %isStable.exit.unr-lcssa ], [ %spec.select.i43.epil, %for.body.i40.epil ]
%.not = icmp eq i32 %spec.select.i43.lcssa, 0
%spec.select = select i1 %.not, ptr @str.8, ptr @str.7
br label %if.end
if.end: ; preds = %isStable.exit, %Selection.exit
%str.7.sink = phi ptr [ @str.8, %Selection.exit ], [ %spec.select, %isStable.exit ]
%puts24 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %B) #5
call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %A) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
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, !9, i64 4}
!6 = !{!"", !7, i64 0, !9, i64 4}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!6, !7, i64 0}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = !{!9, !9, i64 0}
!22 = distinct !{!22, !11}
!23 = distinct !{!23, !20}
|
#include<stdio.h>
#define N 36
typedef struct{
char suit;
int value;
}Card;
int main(){
int i, j, n, min, flag=0;
Card a[N], b[N], a1, a2;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf(" %c%d", &a[i].suit, &a[i].value);
b[i].suit = a[i].suit;
b[i].value = a[i].value;
}
for(i = 0; i < n-1; i++){
for(j = n-1; j > i; j--){
if(a[j].value < a[j-1].value){
a1 = a[j];
a2 = a[j-1];
a[j] = a2;
a[j-1] = a1;
}
}
}
for(i = 0; i < n; i++){
min = i;
for(j = i; j < n; j++){
if(b[j].value < b[min].value){
min = j;
}
}
a1 = b[i];
a2 = b[min];
b[i] = a2;
b[min] = a1;
}
for(i = 0; i < n-1; i++){
printf("%c%d ", a[i].suit, a[i].value);
}
printf("%c%d\n", a[n-1].suit, a[n-1].value);
printf("Stable\n");
for(i = 0; i < n-1; i++){
printf("%c%d ", b[i].suit, b[i].value);
}
printf("%c%d\n", b[n-1].suit, b[n-1].value);
for(i = 0; i <= n-1; i++){
if(a[i].suit != b[i].suit){
flag = 1;
}
}
if(flag == 1)
printf("Not stable\n");
else
printf("Stable\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113497/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113497/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Card = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.6 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [36 x %struct.Card], align 16
%b = alloca [36 x %struct.Card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp196 = icmp sgt i32 %0, 0
br i1 %cmp196, label %for.body, label %for.cond75.preheader.thread
for.cond75.preheader.thread: ; preds = %entry
%sub247 = add i32 %0, -1
br label %for.cond75.preheader.for.end88_crit_edge
for.cond16.preheader: ; preds = %for.body
%sub = add i32 %5, -1
%cmp17199 = icmp sgt i32 %5, 1
br i1 %cmp17199, label %for.cond20.preheader.preheader, label %for.cond46.preheader
for.cond20.preheader.preheader: ; preds = %for.cond16.preheader
%1 = zext i32 %5 to i64
%2 = add nsw i64 %1, -1
%wide.trip.count = zext i32 %sub to i64
br label %for.cond20.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv
%value = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %value)
%3 = load i8, ptr %arrayidx, align 8, !tbaa !9
%arrayidx8 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv
store i8 %3, ptr %arrayidx8, align 8, !tbaa !9
%4 = load i32, ptr %value, align 4, !tbaa !11
%value15 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv, i32 1
store i32 %4, ptr %value15, align 4, !tbaa !11
%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.cond16.preheader, !llvm.loop !12
for.cond20.preheader: ; preds = %for.cond20.preheader.preheader, %for.inc43
%indvars.iv224 = phi i64 [ 0, %for.cond20.preheader.preheader ], [ %indvars.iv.next225, %for.inc43 ]
br label %for.body22
for.cond46.preheader: ; preds = %for.inc43, %for.cond16.preheader
%cmp17199250 = phi i1 [ false, %for.cond16.preheader ], [ %cmp17199, %for.inc43 ]
%cmp47203 = icmp sgt i32 %5, 0
br i1 %cmp47203, label %for.cond49.preheader.preheader, label %for.cond75.preheader
for.cond49.preheader.preheader: ; preds = %for.cond46.preheader
%7 = zext i32 %5 to i64
%wide.trip.count233 = zext i32 %5 to i64
br label %for.cond49.preheader
for.body22: ; preds = %for.cond20.preheader, %for.inc41
%indvars.iv221 = phi i64 [ %2, %for.cond20.preheader ], [ %indvars.iv.next222, %for.inc41 ]
%value25 = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv221, i32 1
%8 = load i32, ptr %value25, align 4, !tbaa !11
%indvars.iv.next222 = add nsw i64 %indvars.iv221, -1
%value29 = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv.next222, i32 1
%9 = load i32, ptr %value29, align 4, !tbaa !11
%cmp30 = icmp slt i32 %8, %9
br i1 %cmp30, label %if.then, label %for.inc41
if.then: ; preds = %for.body22
%arrayidx28 = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv.next222
%10 = load <2 x i64>, ptr %arrayidx28, align 8
%11 = shufflevector <2 x i64> %10, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %11, ptr %arrayidx28, align 8
br label %for.inc41
for.inc41: ; preds = %for.body22, %if.then
%cmp21 = icmp sgt i64 %indvars.iv.next222, %indvars.iv224
br i1 %cmp21, label %for.body22, label %for.inc43, !llvm.loop !14
for.inc43: ; preds = %for.inc41
%indvars.iv.next225 = add nuw nsw i64 %indvars.iv224, 1
%exitcond.not = icmp eq i64 %indvars.iv.next225, %wide.trip.count
br i1 %exitcond.not, label %for.cond46.preheader, label %for.cond20.preheader, !llvm.loop !15
for.cond49.preheader: ; preds = %for.cond49.preheader.preheader, %for.end63
%indvars.iv227 = phi i64 [ 0, %for.cond49.preheader.preheader ], [ %indvars.iv.next228, %for.end63 ]
%12 = trunc i64 %indvars.iv227 to i32
br label %for.body51
for.cond75.preheader: ; preds = %for.end63, %for.cond46.preheader
br i1 %cmp17199250, label %for.body78, label %for.cond75.preheader.for.end88_crit_edge
for.cond75.preheader.for.end88_crit_edge: ; preds = %for.cond75.preheader.thread, %for.cond75.preheader
%sub249255258 = phi i32 [ %sub247, %for.cond75.preheader.thread ], [ %sub, %for.cond75.preheader ]
%.pre = sext i32 %sub249255258 to i64
br label %for.end88
for.body51: ; preds = %for.cond49.preheader, %for.body51
%indvars.iv229 = phi i64 [ %indvars.iv227, %for.cond49.preheader ], [ %indvars.iv.next230, %for.body51 ]
%min.0202 = phi i32 [ %12, %for.cond49.preheader ], [ %spec.select, %for.body51 ]
%value54 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv229, i32 1
%13 = load i32, ptr %value54, align 4, !tbaa !11
%idxprom55 = sext i32 %min.0202 to i64
%value57 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %idxprom55, i32 1
%14 = load i32, ptr %value57, align 4, !tbaa !11
%cmp58 = icmp slt i32 %13, %14
%15 = trunc i64 %indvars.iv229 to i32
%spec.select = select i1 %cmp58, i32 %15, i32 %min.0202
%indvars.iv.next230 = add nuw nsw i64 %indvars.iv229, 1
%cmp50 = icmp ult i64 %indvars.iv.next230, %7
br i1 %cmp50, label %for.body51, label %for.end63, !llvm.loop !16
for.end63: ; preds = %for.body51
%arrayidx65 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv227
%16 = load i64, ptr %arrayidx65, align 8
%idxprom66 = sext i32 %spec.select to i64
%arrayidx67 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %idxprom66
%17 = load i64, ptr %arrayidx67, align 8
store i64 %17, ptr %arrayidx65, align 8
store i64 %16, ptr %arrayidx67, align 8
%indvars.iv.next228 = add nuw nsw i64 %indvars.iv227, 1
%exitcond234.not = icmp eq i64 %indvars.iv.next228, %wide.trip.count233
br i1 %exitcond234.not, label %for.cond75.preheader, label %for.cond49.preheader, !llvm.loop !17
for.body78: ; preds = %for.cond75.preheader, %for.body78
%indvars.iv235 = phi i64 [ %indvars.iv.next236, %for.body78 ], [ 0, %for.cond75.preheader ]
%arrayidx80 = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv235
%18 = load i8, ptr %arrayidx80, align 8, !tbaa !9
%conv = sext i8 %18 to i32
%value84 = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv235, i32 1
%19 = load i32, ptr %value84, align 4, !tbaa !11
%call85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %19)
%indvars.iv.next236 = add nuw nsw i64 %indvars.iv235, 1
%20 = load i32, ptr %n, align 4, !tbaa !5
%sub76 = add nsw i32 %20, -1
%21 = sext i32 %sub76 to i64
%cmp77 = icmp slt i64 %indvars.iv.next236, %21
br i1 %cmp77, label %for.body78, label %for.end88, !llvm.loop !18
for.end88: ; preds = %for.body78, %for.cond75.preheader.for.end88_crit_edge
%idxprom90.pre-phi = phi i64 [ %.pre, %for.cond75.preheader.for.end88_crit_edge ], [ %21, %for.body78 ]
%arrayidx91 = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %idxprom90.pre-phi
%22 = load i8, ptr %arrayidx91, align 8, !tbaa !9
%conv93 = sext i8 %22 to i32
%value97 = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %idxprom90.pre-phi, i32 1
%23 = load i32, ptr %value97, align 4, !tbaa !11
%call98 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv93, i32 noundef %23)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%24 = load i32, ptr %n, align 4, !tbaa !5
%cmp102210 = icmp sgt i32 %24, 1
br i1 %cmp102210, label %for.body104, label %for.end88.for.end115_crit_edge
for.end88.for.end115_crit_edge: ; preds = %for.end88
%sub101209 = add nsw i32 %24, -1
%.pre246 = sext i32 %sub101209 to i64
br label %for.end115
for.body104: ; preds = %for.end88, %for.body104
%indvars.iv238 = phi i64 [ %indvars.iv.next239, %for.body104 ], [ 0, %for.end88 ]
%arrayidx106 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv238
%25 = load i8, ptr %arrayidx106, align 8, !tbaa !9
%conv108 = sext i8 %25 to i32
%value111 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv238, i32 1
%26 = load i32, ptr %value111, align 4, !tbaa !11
%call112 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv108, i32 noundef %26)
%indvars.iv.next239 = add nuw nsw i64 %indvars.iv238, 1
%27 = load i32, ptr %n, align 4, !tbaa !5
%sub101 = add nsw i32 %27, -1
%28 = sext i32 %sub101 to i64
%cmp102 = icmp slt i64 %indvars.iv.next239, %28
br i1 %cmp102, label %for.body104, label %for.end115, !llvm.loop !19
for.end115: ; preds = %for.body104, %for.end88.for.end115_crit_edge
%idxprom117.pre-phi = phi i64 [ %.pre246, %for.end88.for.end115_crit_edge ], [ %28, %for.body104 ]
%arrayidx118 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %idxprom117.pre-phi
%29 = load i8, ptr %arrayidx118, align 8, !tbaa !9
%conv120 = sext i8 %29 to i32
%value124 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %idxprom117.pre-phi, i32 1
%30 = load i32, ptr %value124, align 4, !tbaa !11
%call125 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv120, i32 noundef %30)
%31 = load i32, ptr %n, align 4, !tbaa !5
%cmp128.not.not213 = icmp sgt i32 %31, 0
br i1 %cmp128.not.not213, label %for.body130.preheader, label %if.else
for.body130.preheader: ; preds = %for.end115
%wide.trip.count244 = zext i32 %31 to i64
%xtraiter = and i64 %wide.trip.count244, 3
%32 = icmp ult i32 %31, 4
br i1 %32, label %for.end145.unr-lcssa, label %for.body130.preheader.new
for.body130.preheader.new: ; preds = %for.body130.preheader
%unroll_iter = and i64 %wide.trip.count244, 4294967292
br label %for.body130
for.body130: ; preds = %for.body130, %for.body130.preheader.new
%indvars.iv241 = phi i64 [ 0, %for.body130.preheader.new ], [ %indvars.iv.next242.3, %for.body130 ]
%flag.0215 = phi i32 [ 0, %for.body130.preheader.new ], [ %spec.select195.3, %for.body130 ]
%niter = phi i64 [ 0, %for.body130.preheader.new ], [ %niter.next.3, %for.body130 ]
%arrayidx132 = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv241
%33 = load i8, ptr %arrayidx132, align 16, !tbaa !9
%arrayidx136 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv241
%34 = load i8, ptr %arrayidx136, align 16, !tbaa !9
%cmp139.not = icmp eq i8 %33, %34
%indvars.iv.next242 = or i64 %indvars.iv241, 1
%arrayidx132.1 = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv.next242
%35 = load i8, ptr %arrayidx132.1, align 8, !tbaa !9
%arrayidx136.1 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv.next242
%36 = load i8, ptr %arrayidx136.1, align 8, !tbaa !9
%cmp139.not.1 = icmp eq i8 %35, %36
%indvars.iv.next242.1 = or i64 %indvars.iv241, 2
%arrayidx132.2 = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv.next242.1
%37 = load i8, ptr %arrayidx132.2, align 16, !tbaa !9
%arrayidx136.2 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv.next242.1
%38 = load i8, ptr %arrayidx136.2, align 16, !tbaa !9
%cmp139.not.2 = icmp eq i8 %37, %38
%indvars.iv.next242.2 = or i64 %indvars.iv241, 3
%arrayidx132.3 = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv.next242.2
%39 = load i8, ptr %arrayidx132.3, align 8, !tbaa !9
%arrayidx136.3 = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv.next242.2
%40 = load i8, ptr %arrayidx136.3, align 8, !tbaa !9
%cmp139.not.3 = icmp eq i8 %39, %40
%41 = select i1 %cmp139.not.3, i1 %cmp139.not.2, i1 false
%42 = select i1 %41, i1 %cmp139.not.1, i1 false
%43 = select i1 %42, i1 %cmp139.not, i1 false
%spec.select195.3 = select i1 %43, i32 %flag.0215, i32 1
%indvars.iv.next242.3 = add nuw nsw i64 %indvars.iv241, 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.end145.unr-lcssa, label %for.body130, !llvm.loop !20
for.end145.unr-lcssa: ; preds = %for.body130, %for.body130.preheader
%spec.select195.lcssa.ph = phi i32 [ undef, %for.body130.preheader ], [ %spec.select195.3, %for.body130 ]
%indvars.iv241.unr = phi i64 [ 0, %for.body130.preheader ], [ %indvars.iv.next242.3, %for.body130 ]
%flag.0215.unr = phi i32 [ 0, %for.body130.preheader ], [ %spec.select195.3, %for.body130 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end145, label %for.body130.epil
for.body130.epil: ; preds = %for.end145.unr-lcssa, %for.body130.epil
%indvars.iv241.epil = phi i64 [ %indvars.iv.next242.epil, %for.body130.epil ], [ %indvars.iv241.unr, %for.end145.unr-lcssa ]
%flag.0215.epil = phi i32 [ %spec.select195.epil, %for.body130.epil ], [ %flag.0215.unr, %for.end145.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body130.epil ], [ 0, %for.end145.unr-lcssa ]
%arrayidx132.epil = getelementptr inbounds [36 x %struct.Card], ptr %a, i64 0, i64 %indvars.iv241.epil
%44 = load i8, ptr %arrayidx132.epil, align 8, !tbaa !9
%arrayidx136.epil = getelementptr inbounds [36 x %struct.Card], ptr %b, i64 0, i64 %indvars.iv241.epil
%45 = load i8, ptr %arrayidx136.epil, align 8, !tbaa !9
%cmp139.not.epil = icmp eq i8 %44, %45
%spec.select195.epil = select i1 %cmp139.not.epil, i32 %flag.0215.epil, i32 1
%indvars.iv.next242.epil = add nuw nsw i64 %indvars.iv241.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.end145, label %for.body130.epil, !llvm.loop !21
for.end145: ; preds = %for.body130.epil, %for.end145.unr-lcssa
%spec.select195.lcssa = phi i32 [ %spec.select195.lcssa.ph, %for.end145.unr-lcssa ], [ %spec.select195.epil, %for.body130.epil ]
%46 = icmp eq i32 %spec.select195.lcssa, 1
br i1 %46, label %if.end151, label %if.else
if.else: ; preds = %for.end115, %for.end145
br label %if.end151
if.end151: ; preds = %for.end145, %if.else
%str.6.sink = phi ptr [ @str.6, %if.else ], [ @str.7, %for.end145 ]
%puts193 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !7, i64 0}
!10 = !{!"", !7, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
#include <stdbool.h>
#define MAXSIZE 36
struct card{
char suit[1]; //A, H, C, D
int value; //1,2, ..., 9
};
void trace(struct card A[], int N){
int i;
for(i = 0; i < N; i++){
if(i > 0) printf(" ");
printf("%c%d", *A[i].suit, A[i].value);
}
printf("\n");
}
void BubbleSort(struct card A[], int N){
int i,j,t1;
char t2[1];
for(i = 0; i < N; i++){
for(j = N-1; j > i; j--){
if( A[j].value < A[j-1].value){
t1 = A[j].value;
*t2 = *A[j].suit;
A[j].value = A[j-1].value;
*A[j].suit = *A[j-1].suit;
A[j-1].value = t1;
*A[j-1].suit = *t2;
}
}
}
}
void SelectionSort (struct card B[], int N ){
int i,j,t1,min;
char t2[1];
for( i = 0; i < N; i++ ){
min = i;
for( j = i; j < N; j++ ){
if( B[j].value < B[min].value) min = j;
}
t1 = B[min].value;
*t2 = *B[min].suit;
B[min].value = B[i].value;
*B[min].suit = *B[i].suit;
B[i].value = t1;
*B[i].suit = *t2;
}
}
bool isStable( struct card A[], struct card B[], int N ){
for( int i = 0; i < N; i++){
if( *A[i].suit != *B[i].suit ) return (false);
}
return (true);
}
int main(){
struct card A[MAXSIZE], B[MAXSIZE];
int N;
int i;
scanf("%d", &N);
getchar();
for( i = 0; i < N; i++ ){
scanf("%c%d", A[i].suit, &A[i].value);
getchar();
}
for( i = 0; i < N; i++ ){
*B[i].suit = *A[i].suit;
B[i].value = A[i].value;
}
BubbleSort(A, N);
trace(A, N);
printf("Stable\n");
SelectionSort(B, N);
trace(B, N);
if(isStable(A, B, N)){
printf("Stable\n");
}else{
printf("Not stable\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113554/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113554/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.card = type { [1 x i8], i32 }
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@str.6 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @trace(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp12 = icmp sgt i32 %N, 0
br i1 %cmp12, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%value.peel.phi.trans.insert = getelementptr inbounds %struct.card, ptr %A, i64 0, i32 1
%.pre16 = load i32, ptr %value.peel.phi.trans.insert, align 4, !tbaa !5
%.pre = load i8, ptr %A, align 4, !tbaa !10
%conv.peel = sext i8 %.pre to i32
%call4.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel, i32 noundef %.pre16)
%exitcond.peel.not = icmp eq i32 %N, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar11 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 4, !tbaa !10
%conv = sext i8 %0 to i32
%value = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv, i32 1
%1 = load i32, ptr %value, align 4, !tbaa !5
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %1)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !11
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @BubbleSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp71 = icmp sgt i32 %N, 0
br i1 %cmp71, label %for.cond1.preheader.lr.ph, label %for.end42
for.cond1.preheader.lr.ph: ; preds = %entry
%j.067 = add nsw i32 %N, -1
%0 = zext i32 %N to i64
%1 = add nsw i64 %0, -1
%2 = zext i32 %j.067 to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc41
%indvars.iv79 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next80, %for.inc41 ]
%cmp268 = icmp ult i64 %indvars.iv79, %2
br i1 %cmp268, label %for.body3, label %for.inc41
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv73 = phi i64 [ %indvars.iv.next74, %for.inc ], [ %0, %for.cond1.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond1.preheader ]
%indvars.iv.next74 = add nsw i64 %indvars.iv73, -1
%value = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv, i32 1
%3 = load i32, ptr %value, align 4, !tbaa !5
%4 = add nsw i64 %indvars.iv73, -2
%value7 = getelementptr inbounds %struct.card, ptr %A, i64 %4, i32 1
%5 = load i32, ptr %value7, align 4, !tbaa !5
%cmp8 = icmp slt i32 %3, %5
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.card, ptr %A, i64 %4
%arrayidx = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv
%6 = load i8, ptr %arrayidx, align 4, !tbaa !10
store i32 %5, ptr %value, align 4, !tbaa !5
%7 = load i8, ptr %arrayidx6, align 4, !tbaa !10
store i8 %7, ptr %arrayidx, align 4, !tbaa !10
store i32 %3, ptr %value7, align 4, !tbaa !5
store i8 %6, ptr %arrayidx6, align 4, !tbaa !10
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp2 = icmp sgt i64 %indvars.iv.next, %indvars.iv79
br i1 %cmp2, label %for.body3, label %for.inc41, !llvm.loop !14
for.inc41: ; preds = %for.inc, %for.cond1.preheader
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%exitcond.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count
br i1 %exitcond.not, label %for.end42, label %for.cond1.preheader, !llvm.loop !15
for.end42: ; preds = %for.inc41, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @SelectionSort(ptr nocapture noundef %B, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp65 = icmp sgt i32 %N, 0
br i1 %cmp65, label %for.cond1.preheader.preheader, label %for.end38
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv67 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next68, %for.body3 ]
%min.064 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%value = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv67, i32 1
%2 = load i32, ptr %value, align 4, !tbaa !5
%idxprom4 = sext i32 %min.064 to i64
%value6 = getelementptr inbounds %struct.card, ptr %B, i64 %idxprom4, i32 1
%3 = load i32, ptr %value6, align 4, !tbaa !5
%cmp7 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv67 to i32
%spec.select = select i1 %cmp7, i32 %4, i32 %min.064
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%cmp2 = icmp ult i64 %indvars.iv.next68, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !16
for.end: ; preds = %for.body3
%idxprom8 = sext i32 %spec.select to i64
%arrayidx9 = getelementptr inbounds %struct.card, ptr %B, i64 %idxprom8
%value10 = getelementptr inbounds %struct.card, ptr %B, i64 %idxprom8, i32 1
%5 = load i32, ptr %value10, align 4, !tbaa !5
%6 = load i8, ptr %arrayidx9, align 4, !tbaa !10
%arrayidx15 = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv
%value16 = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv, i32 1
%7 = load i32, ptr %value16, align 4, !tbaa !5
store i32 %7, ptr %value10, align 4, !tbaa !5
%8 = load i8, ptr %arrayidx15, align 4, !tbaa !10
store i8 %8, ptr %arrayidx9, align 4, !tbaa !10
store i32 %5, ptr %value16, align 4, !tbaa !5
store i8 %6, ptr %arrayidx15, align 4, !tbaa !10
%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.end38, label %for.cond1.preheader, !llvm.loop !17
for.end38: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local zeroext i1 @isStable(ptr nocapture noundef readonly %A, ptr nocapture noundef readonly %B, i32 noundef %N) local_unnamed_addr #4 {
entry:
%cmp11 = icmp slt i32 %N, 1
br i1 %cmp11, label %cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
%1 = load i8, ptr %A, align 4, !tbaa !10
%2 = load i8, ptr %B, align 4, !tbaa !10
%cmp6.not15 = icmp eq i8 %1, %2
br i1 %cmp6.not15, label %for.cond, label %cleanup
for.cond: ; preds = %for.body.preheader, %for.body
%indvars.iv16 = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv16, 1
%exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond, label %cleanup.loopexit, label %for.body, !llvm.loop !18
for.body: ; preds = %for.cond
%arrayidx = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx, align 4, !tbaa !10
%arrayidx2 = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx2, align 4, !tbaa !10
%cmp6.not = icmp eq i8 %3, %4
br i1 %cmp6.not, label %for.cond, label %cleanup.loopexit, !llvm.loop !18
cleanup.loopexit: ; preds = %for.cond, %for.body
%cmp.le = icmp uge i64 %indvars.iv.next, %0
br label %cleanup
cleanup: ; preds = %cleanup.loopexit, %for.body.preheader, %entry
%cmp.lcssa = phi i1 [ true, %entry ], [ false, %for.body.preheader ], [ %cmp.le, %cleanup.loopexit ]
ret i1 %cmp.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [36 x %struct.card], align 16
%B = alloca [36 x %struct.card], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %A) #6
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %B) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %N)
%0 = load ptr, ptr @stdin, align 8, !tbaa !19
%call.i = call i32 @getc(ptr noundef %0)
%1 = load i32, ptr %N, align 4, !tbaa !21
%cmp88 = icmp sgt i32 %1, 0
br i1 %cmp88, label %for.body, label %trace.exit
for.cond6.preheader: ; preds = %for.body
%cmp790 = icmp sgt i32 %4, 0
br i1 %cmp790, label %for.body8.preheader, label %trace.exit
for.body8.preheader: ; preds = %for.cond6.preheader
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count, 1
%2 = icmp eq i32 %4, 1
br i1 %2, label %for.end25.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.card], ptr %A, i64 0, i64 %indvars.iv
%value = getelementptr inbounds [36 x %struct.card], ptr %A, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %value)
%3 = load ptr, ptr @stdin, align 8, !tbaa !19
%call.i47 = call i32 @getc(ptr noundef %3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %N, align 4, !tbaa !21
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !22
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv98 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next99.1, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.1, %for.body8 ]
%arrayidx10 = getelementptr inbounds [36 x %struct.card], ptr %A, i64 0, i64 %indvars.iv98
%6 = load i8, ptr %arrayidx10, align 16, !tbaa !10
%arrayidx14 = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv98
store i8 %6, ptr %arrayidx14, align 16, !tbaa !10
%value19 = getelementptr inbounds [36 x %struct.card], ptr %A, i64 0, i64 %indvars.iv98, i32 1
%7 = load i32, ptr %value19, align 4, !tbaa !5
%value22 = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv98, i32 1
store i32 %7, ptr %value22, align 4, !tbaa !5
%indvars.iv.next99 = or i64 %indvars.iv98, 1
%arrayidx10.1 = getelementptr inbounds [36 x %struct.card], ptr %A, i64 0, i64 %indvars.iv.next99
%8 = load i8, ptr %arrayidx10.1, align 8, !tbaa !10
%arrayidx14.1 = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv.next99
store i8 %8, ptr %arrayidx14.1, align 8, !tbaa !10
%value19.1 = getelementptr inbounds [36 x %struct.card], ptr %A, i64 0, i64 %indvars.iv.next99, i32 1
%9 = load i32, ptr %value19.1, align 4, !tbaa !5
%value22.1 = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv.next99, i32 1
store i32 %9, ptr %value22.1, align 4, !tbaa !5
%indvars.iv.next99.1 = add nuw nsw i64 %indvars.iv98, 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.end25.unr-lcssa, label %for.body8, !llvm.loop !23
for.end25.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%indvars.iv98.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next99.1, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end25, label %for.body8.epil
for.body8.epil: ; preds = %for.end25.unr-lcssa
%arrayidx10.epil = getelementptr inbounds [36 x %struct.card], ptr %A, i64 0, i64 %indvars.iv98.unr
%10 = load i8, ptr %arrayidx10.epil, align 8, !tbaa !10
%arrayidx14.epil = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv98.unr
store i8 %10, ptr %arrayidx14.epil, align 8, !tbaa !10
%value19.epil = getelementptr inbounds [36 x %struct.card], ptr %A, i64 0, i64 %indvars.iv98.unr, i32 1
%11 = load i32, ptr %value19.epil, align 4, !tbaa !5
%value22.epil = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv98.unr, i32 1
store i32 %11, ptr %value22.epil, align 4, !tbaa !5
br label %for.end25
for.end25: ; preds = %for.end25.unr-lcssa, %for.body8.epil
br i1 %cmp790, label %for.cond1.preheader.lr.ph.i, label %trace.exit
for.cond1.preheader.lr.ph.i: ; preds = %for.end25
%j.067.i = add nsw i32 %4, -1
%12 = zext i32 %4 to i64
%13 = add nsw i64 %12, -1
%14 = zext i32 %j.067.i to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc41.i, %for.cond1.preheader.lr.ph.i
%indvars.iv79.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next80.i, %for.inc41.i ]
%cmp268.i = icmp ult i64 %indvars.iv79.i, %14
br i1 %cmp268.i, label %for.body3.i, label %for.inc41.i
for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv73.i = phi i64 [ %indvars.iv.next74.i, %for.inc.i ], [ %12, %for.cond1.preheader.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %13, %for.cond1.preheader.i ]
%indvars.iv.next74.i = add nsw i64 %indvars.iv73.i, -1
%value.i = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv.i, i32 1
%15 = load i32, ptr %value.i, align 4, !tbaa !5
%16 = add nsw i64 %indvars.iv73.i, -2
%value7.i = getelementptr inbounds %struct.card, ptr %A, i64 %16, i32 1
%17 = load i32, ptr %value7.i, align 4, !tbaa !5
%cmp8.i = icmp slt i32 %15, %17
br i1 %cmp8.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.card, ptr %A, i64 %16
%arrayidx.i = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv.i
%18 = load i8, ptr %arrayidx.i, align 8, !tbaa !10
store i32 %17, ptr %value.i, align 4, !tbaa !5
%19 = load i8, ptr %arrayidx6.i, align 8, !tbaa !10
store i8 %19, ptr %arrayidx.i, align 8, !tbaa !10
store i32 %15, ptr %value7.i, align 4, !tbaa !5
store i8 %18, ptr %arrayidx6.i, align 8, !tbaa !10
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%cmp2.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv79.i
br i1 %cmp2.i, label %for.body3.i, label %for.inc41.i, !llvm.loop !14
for.inc41.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.next80.i = add nuw nsw i64 %indvars.iv79.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next80.i, %12
br i1 %exitcond.not.i, label %if.end.peel.i, label %for.cond1.preheader.i, !llvm.loop !15
if.end.peel.i: ; preds = %for.inc41.i
%value.peel.phi.trans.insert.i = getelementptr inbounds %struct.card, ptr %A, i64 0, i32 1
%.pre16.i = load i32, ptr %value.peel.phi.trans.insert.i, align 4, !tbaa !5
%.pre.i = load i8, ptr %A, align 16, !tbaa !10
%conv.peel.i = sext i8 %.pre.i to i32
%call4.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i, i32 noundef %.pre16.i)
%exitcond.peel.not.i = icmp eq i32 %4, 1
br i1 %exitcond.peel.not.i, label %trace.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i49 = phi i64 [ %indvars.iv.next.i52, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar11.i = call i32 @putchar(i32 32)
%arrayidx.i50 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv.i49
%20 = load i8, ptr %arrayidx.i50, align 8, !tbaa !10
%conv.i = sext i8 %20 to i32
%value.i51 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv.i49, i32 1
%21 = load i32, ptr %value.i51, align 4, !tbaa !5
%call4.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i, i32 noundef %21)
%indvars.iv.next.i52 = add nuw nsw i64 %indvars.iv.i49, 1
%exitcond.not.i53 = icmp eq i64 %indvars.iv.next.i52, %12
br i1 %exitcond.not.i53, label %trace.exit, label %if.end.i, !llvm.loop !11
trace.exit: ; preds = %if.end.i, %entry, %for.cond6.preheader, %for.end25, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%22 = load i32, ptr %N, align 4, !tbaa !21
%cmp65.i = icmp sgt i32 %22, 0
br i1 %cmp65.i, label %for.cond1.preheader.preheader.i, label %trace.exit82
for.cond1.preheader.preheader.i: ; preds = %trace.exit
%23 = zext i32 %22 to i64
br label %for.cond1.preheader.i55
for.cond1.preheader.i55: ; preds = %for.end.i, %for.cond1.preheader.preheader.i
%indvars.iv.i56 = phi i64 [ 0, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next.i60, %for.end.i ]
%24 = trunc i64 %indvars.iv.i56 to i32
br label %for.body3.i57
for.body3.i57: ; preds = %for.body3.i57, %for.cond1.preheader.i55
%indvars.iv67.i = phi i64 [ %indvars.iv.i56, %for.cond1.preheader.i55 ], [ %indvars.iv.next68.i, %for.body3.i57 ]
%min.064.i = phi i32 [ %24, %for.cond1.preheader.i55 ], [ %spec.select.i, %for.body3.i57 ]
%value.i58 = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv67.i, i32 1
%25 = load i32, ptr %value.i58, align 4, !tbaa !5
%idxprom4.i = sext i32 %min.064.i to i64
%value6.i = getelementptr inbounds %struct.card, ptr %B, i64 %idxprom4.i, i32 1
%26 = load i32, ptr %value6.i, align 4, !tbaa !5
%cmp7.i = icmp slt i32 %25, %26
%27 = trunc i64 %indvars.iv67.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %27, i32 %min.064.i
%indvars.iv.next68.i = add nuw nsw i64 %indvars.iv67.i, 1
%cmp2.i59 = icmp ult i64 %indvars.iv.next68.i, %23
br i1 %cmp2.i59, label %for.body3.i57, label %for.end.i, !llvm.loop !16
for.end.i: ; preds = %for.body3.i57
%idxprom8.i = sext i32 %spec.select.i to i64
%arrayidx9.i = getelementptr inbounds %struct.card, ptr %B, i64 %idxprom8.i
%value10.i = getelementptr inbounds %struct.card, ptr %B, i64 %idxprom8.i, i32 1
%28 = load i32, ptr %value10.i, align 4, !tbaa !5
%29 = load i8, ptr %arrayidx9.i, align 8, !tbaa !10
%arrayidx15.i = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv.i56
%value16.i = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv.i56, i32 1
%30 = load i32, ptr %value16.i, align 4, !tbaa !5
store i32 %30, ptr %value10.i, align 4, !tbaa !5
%31 = load i8, ptr %arrayidx15.i, align 8, !tbaa !10
store i8 %31, ptr %arrayidx9.i, align 8, !tbaa !10
store i32 %28, ptr %value16.i, align 4, !tbaa !5
store i8 %29, ptr %arrayidx15.i, align 8, !tbaa !10
%indvars.iv.next.i60 = add nuw nsw i64 %indvars.iv.i56, 1
%exitcond.not.i61 = icmp eq i64 %indvars.iv.next.i60, %23
br i1 %exitcond.not.i61, label %if.end.peel.i65, label %for.cond1.preheader.i55, !llvm.loop !17
if.end.peel.i65: ; preds = %for.end.i
%value.peel.phi.trans.insert.i67 = getelementptr inbounds %struct.card, ptr %B, i64 0, i32 1
%.pre16.i68 = load i32, ptr %value.peel.phi.trans.insert.i67, align 4, !tbaa !5
%.pre.i69 = load i8, ptr %B, align 16, !tbaa !10
%conv.peel.i70 = sext i8 %.pre.i69 to i32
%call4.peel.i71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i70, i32 noundef %.pre16.i68)
%exitcond.peel.not.i72 = icmp eq i32 %22, 1
br i1 %exitcond.peel.not.i72, label %trace.exit82, label %if.end.i73
if.end.i73: ; preds = %if.end.peel.i65, %if.end.i73
%indvars.iv.i74 = phi i64 [ %indvars.iv.next.i80, %if.end.i73 ], [ 1, %if.end.peel.i65 ]
%putchar11.i75 = call i32 @putchar(i32 32)
%arrayidx.i76 = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv.i74
%32 = load i8, ptr %arrayidx.i76, align 8, !tbaa !10
%conv.i77 = sext i8 %32 to i32
%value.i78 = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv.i74, i32 1
%33 = load i32, ptr %value.i78, align 4, !tbaa !5
%call4.i79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i77, i32 noundef %33)
%indvars.iv.next.i80 = add nuw nsw i64 %indvars.iv.i74, 1
%exitcond.not.i81 = icmp eq i64 %indvars.iv.next.i80, %23
br i1 %exitcond.not.i81, label %trace.exit82, label %if.end.i73, !llvm.loop !11
trace.exit82: ; preds = %if.end.i73, %trace.exit, %if.end.peel.i65
%putchar.i64 = call i32 @putchar(i32 10)
%34 = load i32, ptr %N, align 4, !tbaa !21
%cmp11.i = icmp slt i32 %34, 1
br i1 %cmp11.i, label %if.end, label %for.body.preheader.i
for.body.preheader.i: ; preds = %trace.exit82
%35 = zext i32 %34 to i64
%36 = load i8, ptr %A, align 16, !tbaa !10
%37 = load i8, ptr %B, align 16, !tbaa !10
%cmp6.not.i92 = icmp eq i8 %36, %37
br i1 %cmp6.not.i92, label %for.cond.i, label %if.else
for.cond.i: ; preds = %for.body.preheader.i, %for.body.i
%indvars.iv.i8493 = phi i64 [ %indvars.iv.next.i86, %for.body.i ], [ 0, %for.body.preheader.i ]
%indvars.iv.next.i86 = add nuw nsw i64 %indvars.iv.i8493, 1
%exitcond.i = icmp eq i64 %indvars.iv.next.i86, %35
br i1 %exitcond.i, label %isStable.exit, label %for.body.i, !llvm.loop !18
for.body.i: ; preds = %for.cond.i
%arrayidx.i85 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv.next.i86
%38 = load i8, ptr %arrayidx.i85, align 8, !tbaa !10
%arrayidx2.i = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv.next.i86
%39 = load i8, ptr %arrayidx2.i, align 8, !tbaa !10
%cmp6.not.i = icmp eq i8 %38, %39
br i1 %cmp6.not.i, label %for.cond.i, label %isStable.exit, !llvm.loop !18
isStable.exit: ; preds = %for.body.i, %for.cond.i
%cmp.i.not.le = icmp ult i64 %indvars.iv.next.i86, %35
br i1 %cmp.i.not.le, label %if.else, label %if.end
if.else: ; preds = %for.body.preheader.i, %isStable.exit
br label %if.end
if.end: ; preds = %isStable.exit, %trace.exit82, %if.else
%str.6.sink = phi ptr [ @str.6, %if.else ], [ @str.7, %trace.exit82 ], [ @str.7, %isStable.exit ]
%puts45 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %B) #6
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %A) #6
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 @getc(ptr nocapture noundef) local_unnamed_addr #2
; 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !9, i64 4}
!6 = !{!"card", !7, i64 0, !9, i64 4}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = !{!20, !20, i64 0}
!20 = !{!"any pointer", !7, i64 0}
!21 = !{!9, !9, i64 0}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 36
struct cards{
char Name;
char Value;
};
void bubble(struct cards p[],int n){
int i,j;
struct cards tmp;
for(i=0;i<n;i++){
for(j=n-1;j>=i;j--){
if(p[j].Value<p[j-1].Value){
tmp=p[j];
p[j]=p[j-1];
p[j-1]=tmp;
}
}
}
}
void selection(struct cards p[],int n){
int i,j,minj;
struct cards tmp;
for(i=0;i<n;i++){
minj=i;
for(j=i;j<n;j++){
if(p[j].Value<p[minj].Value) minj=j;
}
tmp=p[i];
p[i]=p[minj];
p[minj]=tmp;
}
}
int main(){
int i,j,n,flag=0,a1[N],a2[N];
scanf("%d",&n);
struct cards p1[N],p2[N];
for(i=0;i<n;i++){
scanf(" %c%c",&p1[i].Name,&p1[i].Value);
}
for(i=0;i<n;i++){
p2[i]=p1[i];
}
bubble(p1,n);
selection(p2,n);
for(i=0;i<n;i++){
if(i==n-1)printf("%c%c\nStable\n",p1[i].Name,p1[i].Value);
else printf("%c%c ",p1[i].Name,p1[i].Value);
}
for(i=0;i<n;i++){
if(i==n-1)printf("%c%c\n",p2[i].Name,p2[i].Value);
else printf("%c%c ",p2[i].Name,p2[i].Value);
}
for(i=0;i<n;i++){
if(p1[i].Name != p2[i].Name){
printf("Not stable\n");
flag=1;
break;
}
}
if(flag==0)printf("Stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113598/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113598/source.c"
target datalayout = "e-m:e-p270: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.cards = type { i8, i8 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%c\00", align 1
@.str.2 = private unnamed_addr constant [13 x i8] c"%c%c\0AStable\0A\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%c \00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%c%c\0A\00", align 1
@str = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bubble(ptr nocapture noundef %p, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp41 = icmp sgt i32 %n, 0
br i1 %cmp41, label %for.cond1.preheader.lr.ph, label %for.end22
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc21
%indvars.iv45 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next46, %for.inc21 ]
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %0, %for.cond1.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%Value = getelementptr inbounds %struct.cards, ptr %p, i64 %indvars.iv.next, i32 1
%1 = load i8, ptr %Value, align 1, !tbaa !5
%2 = add nsw i64 %indvars.iv, -2
%Value7 = getelementptr inbounds %struct.cards, ptr %p, i64 %2, i32 1
%3 = load i8, ptr %Value7, align 1, !tbaa !5
%cmp9 = icmp slt i8 %1, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.cards, ptr %p, i64 %2
%4 = load <2 x i16>, ptr %arrayidx6, align 1
%5 = shufflevector <2 x i16> %4, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %5, ptr %arrayidx6, align 1
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv45
br i1 %cmp2.not.not, label %for.body3, label %for.inc21, !llvm.loop !9
for.inc21: ; preds = %for.inc
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count
br i1 %exitcond.not, label %for.end22, label %for.cond1.preheader, !llvm.loop !11
for.end22: ; preds = %for.inc21, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @selection(ptr nocapture noundef %p, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp39 = icmp sgt i32 %n, 0
br i1 %cmp39, label %for.cond1.preheader.preheader, label %for.end20
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv41 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next42, %for.body3 ]
%minj.038 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%Value = getelementptr inbounds %struct.cards, ptr %p, i64 %indvars.iv41, i32 1
%2 = load i8, ptr %Value, align 1, !tbaa !5
%idxprom4 = sext i32 %minj.038 to i64
%Value6 = getelementptr inbounds %struct.cards, ptr %p, i64 %idxprom4, i32 1
%3 = load i8, ptr %Value6, align 1, !tbaa !5
%cmp8 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv41 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %minj.038
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%cmp2 = icmp ult i64 %indvars.iv.next42, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body3
%arrayidx11 = getelementptr inbounds %struct.cards, ptr %p, i64 %indvars.iv
%5 = load i16, ptr %arrayidx11, align 1
%idxprom14 = sext i32 %spec.select to i64
%arrayidx15 = getelementptr inbounds %struct.cards, ptr %p, i64 %idxprom14
%6 = load i16, ptr %arrayidx15, align 1
store i16 %6, ptr %arrayidx11, align 1
store i16 %5, ptr %arrayidx15, align 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.cond1.preheader, !llvm.loop !13
for.end20: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%p1 = alloca [36 x %struct.cards], align 16
%p2 = alloca [36 x %struct.cards], align 16
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)
call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %p1) #6
call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %p2) #6
%0 = load i32, ptr %n, align 4, !tbaa !14
%cmp131 = icmp sgt i32 %0, 0
br i1 %cmp131, label %for.body, label %if.end94
for.cond4.preheader: ; preds = %for.body
%cmp5133 = icmp sgt i32 %1, 0
br i1 %cmp5133, label %for.cond1.preheader.lr.ph.i, label %if.end94
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.cards], ptr %p1, i64 0, i64 %indvars.iv
%Value = getelementptr inbounds [36 x %struct.cards], ptr %p1, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %Value)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !14
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !16
for.cond1.preheader.lr.ph.i: ; preds = %for.cond4.preheader
%3 = zext i32 %1 to i64
%4 = shl nuw nsw i64 %3, 1
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %p2, ptr nonnull align 16 %p1, i64 %4, i1 false)
%5 = zext i32 %1 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc21.i, %for.cond1.preheader.lr.ph.i
%indvars.iv45.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next46.i, %for.inc21.i ]
br label %for.body3.i
for.body3.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.i = phi i64 [ %5, %for.cond1.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%Value.i = getelementptr inbounds %struct.cards, ptr %p1, i64 %indvars.iv.next.i, i32 1
%6 = load i8, ptr %Value.i, align 1, !tbaa !5
%7 = add nsw i64 %indvars.iv.i, -2
%Value7.i = getelementptr inbounds %struct.cards, ptr %p1, i64 %7, i32 1
%8 = load i8, ptr %Value7.i, align 1, !tbaa !5
%cmp9.i = icmp slt i8 %6, %8
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.cards, ptr %p1, i64 %7
%9 = load <2 x i16>, ptr %arrayidx6.i, align 2
%10 = shufflevector <2 x i16> %9, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %10, ptr %arrayidx6.i, align 2
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv45.i
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.inc21.i, !llvm.loop !9
for.inc21.i: ; preds = %for.inc.i
%indvars.iv.next46.i = add nuw nsw i64 %indvars.iv45.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next46.i, %5
br i1 %exitcond.not.i, label %for.cond1.preheader.i124, label %for.cond1.preheader.i, !llvm.loop !11
for.cond1.preheader.i124: ; preds = %for.inc21.i, %for.end.i
%indvars.iv.i125 = phi i64 [ %indvars.iv.next.i128, %for.end.i ], [ 0, %for.inc21.i ]
%11 = trunc i64 %indvars.iv.i125 to i32
br label %for.body3.i126
for.body3.i126: ; preds = %for.body3.i126, %for.cond1.preheader.i124
%indvars.iv41.i = phi i64 [ %indvars.iv.i125, %for.cond1.preheader.i124 ], [ %indvars.iv.next42.i, %for.body3.i126 ]
%minj.038.i = phi i32 [ %11, %for.cond1.preheader.i124 ], [ %spec.select.i, %for.body3.i126 ]
%Value.i127 = getelementptr inbounds %struct.cards, ptr %p2, i64 %indvars.iv41.i, i32 1
%12 = load i8, ptr %Value.i127, align 1, !tbaa !5
%idxprom4.i = sext i32 %minj.038.i to i64
%Value6.i = getelementptr inbounds %struct.cards, ptr %p2, i64 %idxprom4.i, i32 1
%13 = load i8, ptr %Value6.i, align 1, !tbaa !5
%cmp8.i = icmp slt i8 %12, %13
%14 = trunc i64 %indvars.iv41.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %14, i32 %minj.038.i
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next42.i, %5
br i1 %cmp2.i, label %for.body3.i126, label %for.end.i, !llvm.loop !12
for.end.i: ; preds = %for.body3.i126
%arrayidx11.i = getelementptr inbounds %struct.cards, ptr %p2, i64 %indvars.iv.i125
%15 = load i16, ptr %arrayidx11.i, align 2
%idxprom14.i = sext i32 %spec.select.i to i64
%arrayidx15.i = getelementptr inbounds %struct.cards, ptr %p2, i64 %idxprom14.i
%16 = load i16, ptr %arrayidx15.i, align 2
store i16 %16, ptr %arrayidx11.i, align 2
store i16 %15, ptr %arrayidx15.i, align 2
%indvars.iv.next.i128 = add nuw nsw i64 %indvars.iv.i125, 1
%exitcond.not.i129 = icmp eq i64 %indvars.iv.next.i128, %5
br i1 %exitcond.not.i129, label %selection.exit, label %for.cond1.preheader.i124, !llvm.loop !13
selection.exit: ; preds = %for.end.i
br i1 %cmp5133, label %for.body17, label %for.cond39.preheader
for.cond39.preheader: ; preds = %for.body17, %selection.exit
%17 = phi i32 [ %1, %selection.exit ], [ %22, %for.body17 ]
%cmp40137 = icmp sgt i32 %17, 0
br i1 %cmp40137, label %for.body42, label %if.end94
for.body17: ; preds = %selection.exit, %for.body17
%indvars.iv148 = phi i64 [ %indvars.iv.next149, %for.body17 ], [ 0, %selection.exit ]
%18 = phi i32 [ %22, %for.body17 ], [ %1, %selection.exit ]
%sub = add nsw i32 %18, -1
%19 = zext i32 %sub to i64
%cmp18 = icmp eq i64 %indvars.iv148, %19
%arrayidx20 = getelementptr inbounds [36 x %struct.cards], ptr %p1, i64 0, i64 %indvars.iv148
%20 = load i8, ptr %arrayidx20, align 2, !tbaa !17
%conv = sext i8 %20 to i32
%Value24 = getelementptr inbounds [36 x %struct.cards], ptr %p1, i64 0, i64 %indvars.iv148, i32 1
%21 = load i8, ptr %Value24, align 1, !tbaa !5
%conv25 = sext i8 %21 to i32
%.str.2..str.3 = select i1 %cmp18, ptr @.str.2, ptr @.str.3
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3, i32 noundef %conv, i32 noundef %conv25)
%indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
%22 = load i32, ptr %n, align 4, !tbaa !14
%23 = sext i32 %22 to i64
%cmp16 = icmp slt i64 %indvars.iv.next149, %23
br i1 %cmp16, label %for.body17, label %for.cond39.preheader, !llvm.loop !18
for.cond70.preheader: ; preds = %for.body42
%cmp71.not140 = icmp sgt i32 %28, 0
br i1 %cmp71.not140, label %for.body73.preheader, label %if.end94
for.body73.preheader: ; preds = %for.cond70.preheader
%wide.trip.count = zext i32 %28 to i64
br label %for.body73
for.body42: ; preds = %for.cond39.preheader, %for.body42
%indvars.iv151 = phi i64 [ %indvars.iv.next152, %for.body42 ], [ 0, %for.cond39.preheader ]
%24 = phi i32 [ %28, %for.body42 ], [ %17, %for.cond39.preheader ]
%sub43 = add nsw i32 %24, -1
%25 = zext i32 %sub43 to i64
%cmp44 = icmp eq i64 %indvars.iv151, %25
%arrayidx48 = getelementptr inbounds [36 x %struct.cards], ptr %p2, i64 0, i64 %indvars.iv151
%26 = load i8, ptr %arrayidx48, align 2, !tbaa !17
%conv50 = sext i8 %26 to i32
%Value53 = getelementptr inbounds [36 x %struct.cards], ptr %p2, i64 0, i64 %indvars.iv151, i32 1
%27 = load i8, ptr %Value53, align 1, !tbaa !5
%conv54 = sext i8 %27 to i32
%.str.4..str.3 = select i1 %cmp44, ptr @.str.4, ptr @.str.3
%call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.4..str.3, i32 noundef %conv50, i32 noundef %conv54)
%indvars.iv.next152 = add nuw nsw i64 %indvars.iv151, 1
%28 = load i32, ptr %n, align 4, !tbaa !14
%29 = sext i32 %28 to i64
%cmp40 = icmp slt i64 %indvars.iv.next152, %29
br i1 %cmp40, label %for.body42, label %for.cond70.preheader, !llvm.loop !19
for.cond70: ; preds = %for.body73
%indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
%exitcond.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count
br i1 %exitcond.not, label %if.end94, label %for.body73, !llvm.loop !20
for.body73: ; preds = %for.body73.preheader, %for.cond70
%indvars.iv154 = phi i64 [ 0, %for.body73.preheader ], [ %indvars.iv.next155, %for.cond70 ]
%arrayidx75 = getelementptr inbounds [36 x %struct.cards], ptr %p1, i64 0, i64 %indvars.iv154
%30 = load i8, ptr %arrayidx75, align 2, !tbaa !17
%arrayidx79 = getelementptr inbounds [36 x %struct.cards], ptr %p2, i64 0, i64 %indvars.iv154
%31 = load i8, ptr %arrayidx79, align 2, !tbaa !17
%cmp82.not = icmp eq i8 %30, %31
br i1 %cmp82.not, label %for.cond70, label %if.end94
if.end94: ; preds = %for.cond70, %for.body73, %for.cond70.preheader, %for.cond39.preheader, %for.cond4.preheader, %entry
%str.sink = phi ptr [ @str.7, %entry ], [ @str.7, %for.cond4.preheader ], [ @str.7, %for.cond39.preheader ], [ @str.7, %for.cond70.preheader ], [ @str, %for.body73 ], [ @str.7, %for.cond70 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %p2) #6
call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %p1) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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, !7, i64 1}
!6 = !{!"cards", !7, i64 0, !7, i64 1}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = distinct !{!16, !10}
!17 = !{!6, !7, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include<stdio.h>
#include<stdlib.h>
void swap(char *x,char *y){
char temp;
temp=*x;
*x=*y;
*y=temp;
}
int main(void){
int i,j,mini,N;
char C[36][3];
char D[36][3];
char E[36][3];
char key[2];
char p,q,r,s;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%s",C[i]);
D[i][0]=C[i][0];
D[i][1]=C[i][1];
}
for(i=0;i<N;i++){
for(j=N-1;j>=i+1;j--){
if((int)C[j][1]<(int)C[j-1][1]){
key[0]=C[j][0];
key[1]=C[j][1];
C[j][0]=C[j-1][0];
C[j][1]=C[j-1][1];
C[j-1][0]=key[0];
C[j-1][1]=key[1];
}
}
}
for(i=0;i<N;i++){
if(i!=0)printf(" ");
printf("%c%c",C[i][0],C[i][1]);
E[i][0]=C[i][0];
E[i][1]=C[i][1];
}
printf("\n");
for(i=0;i<N;i++){
if(C[i][0]!=E[i][0])break;
}
if(i==N)printf("Stable\n");
else printf("Not stable\n");
for(i=0;i<N;i++){
mini=i;
for(j=i;j<N;j++){
if(D[j][1]<D[mini][1]){
mini=j;
}
}
p=D[i][0];
q=D[i][1];
r=D[mini][0];
s=D[mini][1];
swap(&p,&r);
swap(&q,&s);
D[i][0]=p;
D[i][1]=q;
D[mini][0]=r;
D[mini][1]=s;
}
for(i=0;i<N;i++){
if(i!=0)printf(" ");
printf("%c%c",D[i][0],D[i][1]);
}
printf("\n");
for(i=0;i<N;i++){
if(D[i][0]!=E[i][0])break;
}
if(i==N)printf("Stable\n");
else printf("Not stable\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113655/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113655/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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.3 = private unnamed_addr constant [5 x i8] c"%c%c\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.9 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %x, align 1, !tbaa !5
%1 = load i8, ptr %y, align 1, !tbaa !5
store i8 %1, ptr %x, align 1, !tbaa !5
store i8 %0, ptr %y, align 1, !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 i32 @main() local_unnamed_addr #2 {
entry:
%N = alloca i32, align 4
%C = alloca [36 x [3 x i8]], align 16
%D = alloca [36 x [3 x i8]], align 16
%E = alloca [36 x [3 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %C) #5
call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %D) #5
call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %E) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !8
%cmp296 = icmp sgt i32 %0, 0
br i1 %cmp296, label %for.body, label %for.end99
for.cond14.preheader: ; preds = %for.body
%cmp15303 = icmp sgt i32 %4, 0
br i1 %cmp15303, label %for.cond17.preheader.lr.ph, label %for.end99
for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader
%1 = zext i32 %4 to i64
%wide.trip.count = zext i32 %4 to i64
br label %for.cond17.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x [3 x i8]], ptr %C, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
%arrayidx6 = getelementptr inbounds [36 x [3 x i8]], ptr %D, i64 0, i64 %indvars.iv
store i8 %2, ptr %arrayidx6, align 1, !tbaa !5
%arrayidx10 = getelementptr inbounds [36 x [3 x i8]], ptr %C, i64 0, i64 %indvars.iv, i64 1
%3 = load i8, ptr %arrayidx10, align 1, !tbaa !5
%arrayidx13 = getelementptr inbounds [36 x [3 x i8]], ptr %D, i64 0, i64 %indvars.iv, i64 1
store i8 %3, ptr %arrayidx13, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %N, align 4, !tbaa !8
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond14.preheader, !llvm.loop !10
for.cond14.loopexit: ; preds = %for.inc62, %for.cond17.preheader
%exitcond.not = icmp eq i64 %indvars.iv.next331, %wide.trip.count
br i1 %exitcond.not, label %for.cond67.preheader, label %for.cond17.preheader, !llvm.loop !12
for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.cond14.loopexit
%indvars.iv330 = phi i64 [ 0, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next331, %for.cond14.loopexit ]
%indvars.iv.next331 = add nuw nsw i64 %indvars.iv330, 1
%cmp18.not.not299 = icmp ult i64 %indvars.iv.next331, %1
br i1 %cmp18.not.not299, label %for.body19, label %for.cond14.loopexit
for.cond67.preheader: ; preds = %for.cond14.loopexit
br i1 %cmp15303, label %if.end75.peel, label %for.end99
if.end75.peel: ; preds = %for.cond67.preheader
%arrayidx82.peel.phi.trans.insert = getelementptr inbounds [36 x [3 x i8]], ptr %C, i64 0, i64 0, i64 1
%.pre359 = load i8, ptr %arrayidx82.peel.phi.trans.insert, align 1, !tbaa !5
%.pre = load i8, ptr %C, align 16, !tbaa !5
%conv79.peel = sext i8 %.pre to i32
%conv83.peel = sext i8 %.pre359 to i32
%call84.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv79.peel, i32 noundef %conv83.peel)
%6 = load i8, ptr %C, align 16, !tbaa !5
store i8 %6, ptr %E, align 16, !tbaa !5
%7 = load i32, ptr %N, align 4, !tbaa !8
%cmp68.peel = icmp sgt i32 %7, 1
br i1 %cmp68.peel, label %if.end75, label %for.end99
for.body19: ; preds = %for.cond17.preheader, %for.inc62
%indvars.iv326 = phi i64 [ %indvars.iv.next327, %for.inc62 ], [ %1, %for.cond17.preheader ]
%indvars.iv.next327 = add nsw i64 %indvars.iv326, -1
%arrayidx22 = getelementptr inbounds [36 x [3 x i8]], ptr %C, i64 0, i64 %indvars.iv.next327, i64 1
%8 = load i8, ptr %arrayidx22, align 1, !tbaa !5
%9 = add nsw i64 %indvars.iv326, -2
%arrayidx26 = getelementptr inbounds [36 x [3 x i8]], ptr %C, i64 0, i64 %9, i64 1
%10 = load i8, ptr %arrayidx26, align 1, !tbaa !5
%cmp28 = icmp slt i8 %8, %10
br i1 %cmp28, label %if.then, label %for.inc62
if.then: ; preds = %for.body19
%arrayidx25 = getelementptr inbounds [36 x [3 x i8]], ptr %C, i64 0, i64 %9
%arrayidx21 = getelementptr inbounds [36 x [3 x i8]], ptr %C, i64 0, i64 %indvars.iv.next327
%11 = load i8, ptr %arrayidx21, align 1, !tbaa !5
%12 = load i8, ptr %arrayidx25, align 1, !tbaa !5
store i8 %12, ptr %arrayidx21, align 1, !tbaa !5
store i8 %10, ptr %arrayidx22, align 1, !tbaa !5
store i8 %11, ptr %arrayidx25, align 1, !tbaa !5
store i8 %8, ptr %arrayidx26, align 1, !tbaa !5
br label %for.inc62
for.inc62: ; preds = %for.body19, %if.then
%cmp18.not.not = icmp sgt i64 %indvars.iv.next327, %indvars.iv.next331
br i1 %cmp18.not.not, label %for.body19, label %for.cond14.loopexit, !llvm.loop !13
if.end75: ; preds = %if.end75.peel, %if.end75
%indvars.iv333 = phi i64 [ %indvars.iv.next334, %if.end75 ], [ 1, %if.end75.peel ]
%putchar289 = call i32 @putchar(i32 32)
%arrayidx77 = getelementptr inbounds [36 x [3 x i8]], ptr %C, i64 0, i64 %indvars.iv333
%13 = load i8, ptr %arrayidx77, align 1, !tbaa !5
%conv79 = sext i8 %13 to i32
%arrayidx82 = getelementptr inbounds [36 x [3 x i8]], ptr %C, i64 0, i64 %indvars.iv333, i64 1
%14 = load i8, ptr %arrayidx82, align 1, !tbaa !5
%conv83 = sext i8 %14 to i32
%call84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv79, i32 noundef %conv83)
%15 = load i8, ptr %arrayidx77, align 1, !tbaa !5
%arrayidx89 = getelementptr inbounds [36 x [3 x i8]], ptr %E, i64 0, i64 %indvars.iv333
store i8 %15, ptr %arrayidx89, align 1, !tbaa !5
%16 = load i8, ptr %arrayidx82, align 1, !tbaa !5
%arrayidx96 = getelementptr inbounds [36 x [3 x i8]], ptr %E, i64 0, i64 %indvars.iv333, i64 1
store i8 %16, ptr %arrayidx96, align 1, !tbaa !5
%indvars.iv.next334 = add nuw nsw i64 %indvars.iv333, 1
%17 = load i32, ptr %N, align 4, !tbaa !8
%18 = sext i32 %17 to i64
%cmp68 = icmp slt i64 %indvars.iv.next334, %18
br i1 %cmp68, label %if.end75, label %for.end99, !llvm.loop !14
for.end99: ; preds = %if.end75, %entry, %for.cond14.preheader, %if.end75.peel, %for.cond67.preheader
%putchar = call i32 @putchar(i32 10)
%19 = load i32, ptr %N, align 4, !tbaa !8
%cmp102307 = icmp sgt i32 %19, 0
br i1 %cmp102307, label %for.body104.preheader, label %for.end119
for.body104.preheader: ; preds = %for.end99
%wide.trip.count340 = zext i32 %19 to i64
br label %for.body104
for.body104: ; preds = %for.body104.preheader, %for.inc117
%indvars.iv337 = phi i64 [ 0, %for.body104.preheader ], [ %indvars.iv.next338, %for.inc117 ]
%arrayidx106 = getelementptr inbounds [36 x [3 x i8]], ptr %C, i64 0, i64 %indvars.iv337
%20 = load i8, ptr %arrayidx106, align 1, !tbaa !5
%arrayidx110 = getelementptr inbounds [36 x [3 x i8]], ptr %E, i64 0, i64 %indvars.iv337
%21 = load i8, ptr %arrayidx110, align 1, !tbaa !5
%cmp113.not = icmp eq i8 %20, %21
br i1 %cmp113.not, label %for.inc117, label %for.end119.loopexit
for.inc117: ; preds = %for.body104
%indvars.iv.next338 = add nuw nsw i64 %indvars.iv337, 1
%exitcond341.not = icmp eq i64 %indvars.iv.next338, %wide.trip.count340
br i1 %exitcond341.not, label %if.end125, label %for.body104, !llvm.loop !16
for.end119.loopexit: ; preds = %for.body104
%22 = trunc i64 %indvars.iv337 to i32
br label %for.end119
for.end119: ; preds = %for.end119.loopexit, %for.end99
%i.3.lcssa = phi i32 [ 0, %for.end99 ], [ %22, %for.end119.loopexit ]
%cmp120 = icmp eq i32 %i.3.lcssa, %19
%spec.select371 = select i1 %cmp120, ptr @str.9, ptr @str.8
br label %if.end125
if.end125: ; preds = %for.inc117, %for.end119
%str.sink = phi ptr [ %spec.select371, %for.end119 ], [ @str.9, %for.inc117 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%23 = load i32, ptr %N, align 4, !tbaa !8
%cmp127315 = icmp sgt i32 %23, 0
br i1 %cmp127315, label %for.cond130.preheader.preheader, label %for.end196
for.cond130.preheader.preheader: ; preds = %if.end125
%24 = zext i32 %23 to i64
%wide.trip.count348 = zext i32 %23 to i64
br label %for.cond130.preheader
for.cond130.preheader: ; preds = %for.cond130.preheader.preheader, %for.end148
%indvars.iv342 = phi i64 [ 0, %for.cond130.preheader.preheader ], [ %indvars.iv.next343, %for.end148 ]
%25 = trunc i64 %indvars.iv342 to i32
br label %for.body133
for.cond176.preheader: ; preds = %for.end148
br i1 %cmp127315, label %if.end184.peel, label %for.end196
if.end184.peel: ; preds = %for.cond176.preheader
%26 = load i8, ptr %D, align 16, !tbaa !5
%conv188.peel = sext i8 %26 to i32
%arrayidx191.peel = getelementptr inbounds [36 x [3 x i8]], ptr %D, i64 0, i64 0, i64 1
%27 = load i8, ptr %arrayidx191.peel, align 1, !tbaa !5
%conv192.peel = sext i8 %27 to i32
%call193.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv188.peel, i32 noundef %conv192.peel)
%28 = load i32, ptr %N, align 4, !tbaa !8
%cmp177.peel = icmp sgt i32 %28, 1
br i1 %cmp177.peel, label %if.end184, label %for.end196
for.body133: ; preds = %for.cond130.preheader, %for.body133
%indvars.iv344 = phi i64 [ %indvars.iv342, %for.cond130.preheader ], [ %indvars.iv.next345, %for.body133 ]
%mini.0313 = phi i32 [ %25, %for.cond130.preheader ], [ %spec.select, %for.body133 ]
%arrayidx136 = getelementptr inbounds [36 x [3 x i8]], ptr %D, i64 0, i64 %indvars.iv344, i64 1
%29 = load i8, ptr %arrayidx136, align 1, !tbaa !5
%idxprom138 = sext i32 %mini.0313 to i64
%arrayidx140 = getelementptr inbounds [36 x [3 x i8]], ptr %D, i64 0, i64 %idxprom138, i64 1
%30 = load i8, ptr %arrayidx140, align 1, !tbaa !5
%cmp142 = icmp slt i8 %29, %30
%31 = trunc i64 %indvars.iv344 to i32
%spec.select = select i1 %cmp142, i32 %31, i32 %mini.0313
%indvars.iv.next345 = add nuw nsw i64 %indvars.iv344, 1
%cmp131 = icmp ult i64 %indvars.iv.next345, %24
br i1 %cmp131, label %for.body133, label %for.end148, !llvm.loop !17
for.end148: ; preds = %for.body133
%arrayidx150 = getelementptr inbounds [36 x [3 x i8]], ptr %D, i64 0, i64 %indvars.iv342
%32 = load i8, ptr %arrayidx150, align 1, !tbaa !5
%arrayidx154 = getelementptr inbounds [36 x [3 x i8]], ptr %D, i64 0, i64 %indvars.iv342, i64 1
%33 = load i8, ptr %arrayidx154, align 1, !tbaa !5
%idxprom155 = sext i32 %spec.select to i64
%arrayidx156 = getelementptr inbounds [36 x [3 x i8]], ptr %D, i64 0, i64 %idxprom155
%34 = load i8, ptr %arrayidx156, align 1, !tbaa !5
%arrayidx160 = getelementptr inbounds [36 x [3 x i8]], ptr %D, i64 0, i64 %idxprom155, i64 1
%35 = load i8, ptr %arrayidx160, align 1, !tbaa !5
store i8 %34, ptr %arrayidx150, align 1, !tbaa !5
store i8 %35, ptr %arrayidx154, align 1, !tbaa !5
store i8 %32, ptr %arrayidx156, align 1, !tbaa !5
store i8 %33, ptr %arrayidx160, align 1, !tbaa !5
%indvars.iv.next343 = add nuw nsw i64 %indvars.iv342, 1
%exitcond349.not = icmp eq i64 %indvars.iv.next343, %wide.trip.count348
br i1 %exitcond349.not, label %for.cond176.preheader, label %for.cond130.preheader, !llvm.loop !18
if.end184: ; preds = %if.end184.peel, %if.end184
%indvars.iv350 = phi i64 [ %indvars.iv.next351, %if.end184 ], [ 1, %if.end184.peel ]
%putchar288 = call i32 @putchar(i32 32)
%arrayidx186 = getelementptr inbounds [36 x [3 x i8]], ptr %D, i64 0, i64 %indvars.iv350
%36 = load i8, ptr %arrayidx186, align 1, !tbaa !5
%conv188 = sext i8 %36 to i32
%arrayidx191 = getelementptr inbounds [36 x [3 x i8]], ptr %D, i64 0, i64 %indvars.iv350, i64 1
%37 = load i8, ptr %arrayidx191, align 1, !tbaa !5
%conv192 = sext i8 %37 to i32
%call193 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv188, i32 noundef %conv192)
%indvars.iv.next351 = add nuw nsw i64 %indvars.iv350, 1
%38 = load i32, ptr %N, align 4, !tbaa !8
%39 = sext i32 %38 to i64
%cmp177 = icmp slt i64 %indvars.iv.next351, %39
br i1 %cmp177, label %if.end184, label %for.end196, !llvm.loop !19
for.end196: ; preds = %if.end184, %if.end125, %if.end184.peel, %for.cond176.preheader
%putchar285 = call i32 @putchar(i32 10)
%40 = load i32, ptr %N, align 4, !tbaa !8
%cmp199319 = icmp sgt i32 %40, 0
br i1 %cmp199319, label %for.body201.preheader, label %for.end216
for.body201.preheader: ; preds = %for.end196
%wide.trip.count357 = zext i32 %40 to i64
br label %for.body201
for.body201: ; preds = %for.body201.preheader, %for.inc214
%indvars.iv354 = phi i64 [ 0, %for.body201.preheader ], [ %indvars.iv.next355, %for.inc214 ]
%arrayidx203 = getelementptr inbounds [36 x [3 x i8]], ptr %D, i64 0, i64 %indvars.iv354
%41 = load i8, ptr %arrayidx203, align 1, !tbaa !5
%arrayidx207 = getelementptr inbounds [36 x [3 x i8]], ptr %E, i64 0, i64 %indvars.iv354
%42 = load i8, ptr %arrayidx207, align 1, !tbaa !5
%cmp210.not = icmp eq i8 %41, %42
br i1 %cmp210.not, label %for.inc214, label %for.end216.loopexit
for.inc214: ; preds = %for.body201
%indvars.iv.next355 = add nuw nsw i64 %indvars.iv354, 1
%exitcond358.not = icmp eq i64 %indvars.iv.next355, %wide.trip.count357
br i1 %exitcond358.not, label %if.end223, label %for.body201, !llvm.loop !20
for.end216.loopexit: ; preds = %for.body201
%43 = trunc i64 %indvars.iv354 to i32
br label %for.end216
for.end216: ; preds = %for.end216.loopexit, %for.end196
%i.6.lcssa = phi i32 [ 0, %for.end196 ], [ %43, %for.end216.loopexit ]
%cmp217 = icmp eq i32 %i.6.lcssa, %40
%spec.select372 = select i1 %cmp217, ptr @str.9, ptr @str.8
br label %if.end223
if.end223: ; preds = %for.inc214, %for.end216
%str.8.sink = phi ptr [ %spec.select372, %for.end216 ], [ @str.9, %for.inc214 ]
%puts286 = call i32 @puts(ptr nonnull dereferenceable(1) %str.8.sink)
call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %E) #5
call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %D) #5
call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %C) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11, !15}
!15 = !{!"llvm.loop.peeled.count", i32 1}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11, !15}
!20 = distinct !{!20, !11}
|
#include<stdio.h>
struct Card{
char suit;
int value;
};
int main(){
struct Card C1[101], C2[101],key[101];
int n, i,j,mini,count=0;;
char ch;
scanf("%d%c", &n, &ch);
for ( i = 1; i <= n; i++ ){
scanf("%c%d%c", &C1[i].suit, &C1[i].value, &ch);
}
for ( i = 1; i <= n; i++ ){
C2[i]=C1[i];
}
for(i=1;i<=n;i++){
for(j=n;j>=i+1;j--){
if(C1[j].value<C1[j-1].value){
key[j]=C1[j];
C1[j]=C1[j-1];
C1[j-1]=key[j];
}}}
for(i=1;i<=n;i++){
if(i==n){
printf("%c%d\n",C1[i].suit,C1[i].value);
break;
}
printf("%c%d ",C1[i].suit,C1[i].value);
}
printf("Stable\n");
for(i=1;i<=n;i++){
mini=i;
for(j=i;j<=n;j++){
if(C2[j].value<C2[mini].value){
mini=j;
}}
if(C2[mini].value<C2[i].value){
key[i]=C2[i];
C2[i]=C2[mini];
C2[mini]=key[i];
}}
for(i=1;i<=n;i++){
if(i==n){
printf("%c%d\n",C2[i].suit,C2[i].value);
break;
}
printf("%c%d ",C2[i].suit,C2[i].value);
}
for(i=1;i<=n;i++){
if(C1[i].value==C2[i].value && C1[i].suit==C2[i].suit){
count++;
}
else break;
}
if(count==n) printf("Stable\n");
else printf("Not stable\n");
return 0;} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113705/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113705/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Card = type { i8, i32 }
@.str = private unnamed_addr constant [5 x i8] c"%d%c\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%c%d%c\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@str.6 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%C1 = alloca [101 x %struct.Card], align 16
%C2 = alloca [101 x %struct.Card], align 16
%n = alloca i32, align 4
%ch = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 808, ptr nonnull %C1) #5
call void @llvm.lifetime.start.p0(i64 808, ptr nonnull %C2) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %ch) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %ch)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not242 = icmp slt i32 %0, 1
br i1 %cmp.not242, label %for.end69, label %for.body
for.cond4.preheader: ; preds = %for.body
%cmp5.not244 = icmp slt i32 %1, 1
br i1 %cmp5.not244, label %for.end69, label %for.cond17.preheader.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [101 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv
%value = getelementptr inbounds [101 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %value, ptr noundef nonnull %ch)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond17.preheader.preheader: ; preds = %for.cond4.preheader
%scevgep = getelementptr inbounds i8, ptr %C2, i64 8
%scevgep270 = getelementptr inbounds i8, ptr %C1, i64 8
%3 = zext i32 %1 to i64
%4 = shl nuw nsw i64 %3, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %scevgep, ptr nonnull align 8 %scevgep270, i64 %4, i1 false)
%5 = zext i32 %1 to i64
%6 = add nuw i32 %1, 1
%wide.trip.count = zext i32 %6 to i64
br label %for.cond17.preheader
for.cond17.preheader: ; preds = %for.cond17.preheader.preheader, %for.inc43
%indvars.iv277 = phi i64 [ 1, %for.cond17.preheader.preheader ], [ %indvars.iv.next278, %for.inc43 ]
%cmp18.not.not246 = icmp ult i64 %indvars.iv277, %5
br i1 %cmp18.not.not246, label %for.body19, label %for.inc43
for.cond46.preheader: ; preds = %for.inc43
br i1 %cmp5.not244, label %for.end69, label %for.body48
for.body19: ; preds = %for.cond17.preheader, %for.inc41
%indvars.iv274 = phi i64 [ %indvars.iv.next275, %for.inc41 ], [ %5, %for.cond17.preheader ]
%value22 = getelementptr inbounds [101 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv274, i32 1
%7 = load i32, ptr %value22, align 4, !tbaa !11
%indvars.iv.next275 = add nsw i64 %indvars.iv274, -1
%value25 = getelementptr inbounds [101 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv.next275, i32 1
%8 = load i32, ptr %value25, align 4, !tbaa !11
%cmp26 = icmp slt i32 %7, %8
br i1 %cmp26, label %if.then, label %for.inc41
if.then: ; preds = %for.body19
%arrayidx24 = getelementptr inbounds [101 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv.next275
%9 = load <2 x i64>, ptr %arrayidx24, align 8
%10 = shufflevector <2 x i64> %9, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %10, ptr %arrayidx24, align 8
br label %for.inc41
for.inc41: ; preds = %for.body19, %if.then
%cmp18.not.not = icmp sgt i64 %indvars.iv.next275, %indvars.iv277
br i1 %cmp18.not.not, label %for.body19, label %for.inc43, !llvm.loop !13
for.inc43: ; preds = %for.inc41, %for.cond17.preheader
%indvars.iv.next278 = add nuw nsw i64 %indvars.iv277, 1
%exitcond.not = icmp eq i64 %indvars.iv.next278, %wide.trip.count
br i1 %exitcond.not, label %for.cond46.preheader, label %for.cond17.preheader, !llvm.loop !14
for.body48: ; preds = %for.cond46.preheader, %if.end58
%indvars.iv280 = phi i64 [ %indvars.iv.next281, %if.end58 ], [ 1, %for.cond46.preheader ]
%11 = phi i32 [ %17, %if.end58 ], [ %1, %for.cond46.preheader ]
%12 = zext i32 %11 to i64
%cmp49 = icmp eq i64 %indvars.iv280, %12
br i1 %cmp49, label %if.then50, label %if.end58
if.then50: ; preds = %for.body48
%idxprom51 = and i64 %indvars.iv280, 4294967295
%arrayidx52 = getelementptr inbounds [101 x %struct.Card], ptr %C1, i64 0, i64 %idxprom51
%13 = load i8, ptr %arrayidx52, align 8, !tbaa !15
%conv = sext i8 %13 to i32
%value56 = getelementptr inbounds [101 x %struct.Card], ptr %C1, i64 0, i64 %idxprom51, i32 1
%14 = load i32, ptr %value56, align 4, !tbaa !11
%call57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %14)
br label %for.end69
if.end58: ; preds = %for.body48
%arrayidx60 = getelementptr inbounds [101 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv280
%15 = load i8, ptr %arrayidx60, align 8, !tbaa !15
%conv62 = sext i8 %15 to i32
%value65 = getelementptr inbounds [101 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv280, i32 1
%16 = load i32, ptr %value65, align 4, !tbaa !11
%call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv62, i32 noundef %16)
%indvars.iv.next281 = add nuw nsw i64 %indvars.iv280, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp47.not.not = icmp slt i64 %indvars.iv280, %18
br i1 %cmp47.not.not, label %for.body48, label %for.end69, !llvm.loop !16
for.end69: ; preds = %if.end58, %for.cond4.preheader, %entry, %for.cond46.preheader, %if.then50
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%19 = load i32, ptr %n, align 4, !tbaa !5
%cmp72.not254 = icmp slt i32 %19, 1
br i1 %cmp72.not254, label %for.end171, label %for.cond75.preheader.preheader
for.cond75.preheader.preheader: ; preds = %for.end69
%20 = zext i32 %19 to i64
%21 = add nuw i32 %19, 1
%wide.trip.count289 = zext i32 %21 to i64
br label %for.cond75.preheader
for.cond75.preheader: ; preds = %for.cond75.preheader.preheader, %for.inc114
%indvars.iv283 = phi i64 [ 1, %for.cond75.preheader.preheader ], [ %indvars.iv.next284, %for.inc114 ]
%22 = trunc i64 %indvars.iv283 to i32
br label %for.body78
for.cond117.preheader: ; preds = %for.inc114
br i1 %cmp72.not254, label %for.end171, label %for.body120
for.body78: ; preds = %for.cond75.preheader, %for.body78
%indvars.iv285 = phi i64 [ %indvars.iv283, %for.cond75.preheader ], [ %indvars.iv.next286, %for.body78 ]
%mini.0253 = phi i32 [ %22, %for.cond75.preheader ], [ %spec.select, %for.body78 ]
%value81 = getelementptr inbounds [101 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv285, i32 1
%23 = load i32, ptr %value81, align 4, !tbaa !11
%idxprom82 = sext i32 %mini.0253 to i64
%value84 = getelementptr inbounds [101 x %struct.Card], ptr %C2, i64 0, i64 %idxprom82, i32 1
%24 = load i32, ptr %value84, align 4, !tbaa !11
%cmp85 = icmp slt i32 %23, %24
%25 = trunc i64 %indvars.iv285 to i32
%spec.select = select i1 %cmp85, i32 %25, i32 %mini.0253
%indvars.iv.next286 = add nuw nsw i64 %indvars.iv285, 1
%cmp76.not.not = icmp ult i64 %indvars.iv285, %20
br i1 %cmp76.not.not, label %for.body78, label %for.end91, !llvm.loop !17
for.end91: ; preds = %for.body78
%idxprom92 = sext i32 %spec.select to i64
%value94 = getelementptr inbounds [101 x %struct.Card], ptr %C2, i64 0, i64 %idxprom92, i32 1
%26 = load i32, ptr %value94, align 4, !tbaa !11
%value97 = getelementptr inbounds [101 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv283, i32 1
%27 = load i32, ptr %value97, align 4, !tbaa !11
%cmp98 = icmp slt i32 %26, %27
br i1 %cmp98, label %if.then100, label %for.inc114
if.then100: ; preds = %for.end91
%arrayidx96 = getelementptr inbounds [101 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv283
%arrayidx93 = getelementptr inbounds [101 x %struct.Card], ptr %C2, i64 0, i64 %idxprom92
%28 = load i64, ptr %arrayidx96, align 8
%29 = load i64, ptr %arrayidx93, align 8
store i64 %29, ptr %arrayidx96, align 8
store i64 %28, ptr %arrayidx93, align 8
br label %for.inc114
for.inc114: ; preds = %for.end91, %if.then100
%indvars.iv.next284 = add nuw nsw i64 %indvars.iv283, 1
%exitcond290.not = icmp eq i64 %indvars.iv.next284, %wide.trip.count289
br i1 %exitcond290.not, label %for.cond117.preheader, label %for.cond75.preheader, !llvm.loop !18
for.body120: ; preds = %for.cond117.preheader, %if.end132
%indvars.iv291 = phi i64 [ %indvars.iv.next292, %if.end132 ], [ 1, %for.cond117.preheader ]
%30 = phi i32 [ %36, %if.end132 ], [ %19, %for.cond117.preheader ]
%31 = zext i32 %30 to i64
%cmp121 = icmp eq i64 %indvars.iv291, %31
br i1 %cmp121, label %if.then123, label %if.end132
if.then123: ; preds = %for.body120
%idxprom124 = and i64 %indvars.iv291, 4294967295
%arrayidx125 = getelementptr inbounds [101 x %struct.Card], ptr %C2, i64 0, i64 %idxprom124
%32 = load i8, ptr %arrayidx125, align 8, !tbaa !15
%conv127 = sext i8 %32 to i32
%value130 = getelementptr inbounds [101 x %struct.Card], ptr %C2, i64 0, i64 %idxprom124, i32 1
%33 = load i32, ptr %value130, align 4, !tbaa !11
%call131 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv127, i32 noundef %33)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.end143
if.end132: ; preds = %for.body120
%arrayidx134 = getelementptr inbounds [101 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv291
%34 = load i8, ptr %arrayidx134, align 8, !tbaa !15
%conv136 = sext i8 %34 to i32
%value139 = getelementptr inbounds [101 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv291, i32 1
%35 = load i32, ptr %value139, align 4, !tbaa !11
%call140 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv136, i32 noundef %35)
%indvars.iv.next292 = add nuw nsw i64 %indvars.iv291, 1
%36 = load i32, ptr %n, align 4, !tbaa !5
%37 = sext i32 %36 to i64
%cmp118.not.not = icmp slt i64 %indvars.iv291, %37
br i1 %cmp118.not.not, label %for.body120, label %for.end143, !llvm.loop !19
for.end143: ; preds = %if.end132, %if.then123
%38 = phi i32 [ %.pre, %if.then123 ], [ %36, %if.end132 ]
%cmp145.not258 = icmp slt i32 %38, 1
br i1 %cmp145.not258, label %for.end171, label %for.body147
for.body147: ; preds = %for.end143, %if.then166
%indvars.iv294 = phi i64 [ %indvars.iv.next295, %if.then166 ], [ 1, %for.end143 ]
%count.0260 = phi i32 [ %inc167, %if.then166 ], [ 0, %for.end143 ]
%value150 = getelementptr inbounds [101 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv294, i32 1
%39 = load i32, ptr %value150, align 4, !tbaa !11
%value153 = getelementptr inbounds [101 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv294, i32 1
%40 = load i32, ptr %value153, align 4, !tbaa !11
%cmp154 = icmp eq i32 %39, %40
br i1 %cmp154, label %land.lhs.true, label %for.end171
land.lhs.true: ; preds = %for.body147
%arrayidx152 = getelementptr inbounds [101 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv294
%arrayidx149 = getelementptr inbounds [101 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv294
%41 = load i8, ptr %arrayidx149, align 8, !tbaa !15
%42 = load i8, ptr %arrayidx152, align 8, !tbaa !15
%cmp164 = icmp eq i8 %41, %42
br i1 %cmp164, label %if.then166, label %for.end171
if.then166: ; preds = %land.lhs.true
%inc167 = add nuw nsw i32 %count.0260, 1
%indvars.iv.next295 = add nuw nsw i64 %indvars.iv294, 1
%exitcond297.not = icmp eq i32 %inc167, %38
br i1 %exitcond297.not, label %if.end178, label %for.body147, !llvm.loop !20
for.end171: ; preds = %land.lhs.true, %for.body147, %for.end69, %for.cond117.preheader, %for.end143
%43 = phi i32 [ %38, %for.end143 ], [ %19, %for.cond117.preheader ], [ %19, %for.end69 ], [ %38, %for.body147 ], [ %38, %land.lhs.true ]
%count.0.lcssa = phi i32 [ 0, %for.end143 ], [ 0, %for.cond117.preheader ], [ 0, %for.end69 ], [ %count.0260, %for.body147 ], [ %count.0260, %land.lhs.true ]
%cmp172 = icmp eq i32 %count.0.lcssa, %43
%spec.select310 = select i1 %cmp172, ptr @str.7, ptr @str.6
br label %if.end178
if.end178: ; preds = %if.then166, %for.end171
%str.6.sink = phi ptr [ %spec.select310, %for.end171 ], [ @str.7, %if.then166 ]
%puts237 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %ch) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 808, ptr nonnull %C2) #5
call void @llvm.lifetime.end.p0(i64 808, ptr nonnull %C1) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 4}
!12 = !{!"Card", !7, i64 0, !6, i64 4}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = !{!12, !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include <stdio.h>
typedef struct { char suit, value; } Card;
void bubble(Card A[], int N) {
int i,j;
Card t;
for(i = 0; i<N; i++) {
for(j = N-1; j >= i; j--) {
if(A[j].value < A[j-1].value) {
t = A[j]; A[j] = A[j-1]; A[j-1] = t;
}
}
}
}
void selection(Card A[], int N) {
int i,j,minj;
Card t;
for(i=0;i<N;i++) {
minj = i;
for(j=i; j<N; j++) {
if(A[j].value < A[minj].value) minj = j;
}
t = A[i]; A[i] = A[minj]; A[minj] = t;
}
}
void print(Card A[], int N) {
int i;
for(i=0; i<N; i++) {
if(i>0) printf(" ");
printf("%c%d",A[i].suit,A[i].value);
}
printf("\n");
}
int isStable(Card C1[], Card C2[], int N) {
int i;
for(i=0; i<N; i++) {
if(C1[i].suit != C2[i].suit) return 0;
}
return 1;
}
/* オリジナル関数を追加 */
void str2Card(Card *t,char str[]) {
t->suit = str[0];
t->value = str[1] - '0';
}
int main(void) {
Card C1[100], C2[100];
int N,i;
char str[3];
scanf("%d",&N);
for(i=0;i<N; i++) {
scanf("%s",str);
str2Card(&C1[i],str);
}
for(i=0; i<N; i++) C2[i] = C1[i];
bubble(C1,N);
selection(C2,N);
print(C1,N);
printf("Stable\n");
print(C2,N);
if(isStable(C1,C2,N)) {
printf("Stable\n");
} else {
printf("Not stable\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113749/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113749/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Card = type { i8, i8 }
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bubble(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp41 = icmp sgt i32 %N, 0
br i1 %cmp41, label %for.cond1.preheader.lr.ph, label %for.end22
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc21
%indvars.iv45 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next46, %for.inc21 ]
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %0, %for.cond1.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !5
%2 = add nsw i64 %indvars.iv, -2
%value7 = getelementptr inbounds %struct.Card, ptr %A, i64 %2, i32 1
%3 = load i8, ptr %value7, align 1, !tbaa !5
%cmp9 = icmp slt i8 %1, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.Card, ptr %A, i64 %2
%4 = load <2 x i16>, ptr %arrayidx6, align 1
%5 = shufflevector <2 x i16> %4, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %5, ptr %arrayidx6, align 1
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv45
br i1 %cmp2.not.not, label %for.body3, label %for.inc21, !llvm.loop !9
for.inc21: ; preds = %for.inc
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count
br i1 %exitcond.not, label %for.end22, label %for.cond1.preheader, !llvm.loop !11
for.end22: ; preds = %for.inc21, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @selection(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp39 = icmp sgt i32 %N, 0
br i1 %cmp39, label %for.cond1.preheader.preheader, label %for.end20
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv41 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next42, %for.body3 ]
%minj.038 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv41, i32 1
%2 = load i8, ptr %value, align 1, !tbaa !5
%idxprom4 = sext i32 %minj.038 to i64
%value6 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom4, i32 1
%3 = load i8, ptr %value6, align 1, !tbaa !5
%cmp8 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv41 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %minj.038
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%cmp2 = icmp ult i64 %indvars.iv.next42, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body3
%arrayidx11 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%5 = load i16, ptr %arrayidx11, align 1
%idxprom14 = sext i32 %spec.select to i64
%arrayidx15 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom14
%6 = load i16, ptr %arrayidx15, align 1
store i16 %6, ptr %arrayidx11, align 1
store i16 %5, ptr %arrayidx15, align 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.cond1.preheader, !llvm.loop !13
for.end20: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp13 = icmp sgt i32 %N, 0
br i1 %cmp13, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%value.peel.phi.trans.insert = getelementptr inbounds %struct.Card, ptr %A, i64 0, i32 1
%.pre17 = load i8, ptr %value.peel.phi.trans.insert, align 1, !tbaa !5
%.pre = load i8, ptr %A, align 1, !tbaa !14
%conv.peel = sext i8 %.pre to i32
%conv4.peel = sext i8 %.pre17 to i32
%call5.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel, i32 noundef %conv4.peel)
%exitcond.peel.not = icmp eq i32 %N, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar12 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%conv = sext i8 %0 to i32
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !5
%conv4 = sext i8 %1 to i32
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %conv4)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !15
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %C1, ptr nocapture noundef readonly %C2, i32 noundef %N) local_unnamed_addr #5 {
entry:
%cmp10 = icmp sgt i32 %N, 0
br i1 %cmp10, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !17
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%arrayidx2 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !14
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @str2Card(ptr nocapture noundef writeonly %t, ptr nocapture noundef readonly %str) local_unnamed_addr #6 {
entry:
%0 = load i8, ptr %str, align 1, !tbaa !18
store i8 %0, ptr %t, align 1, !tbaa !14
%arrayidx1 = getelementptr inbounds i8, ptr %str, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !18
%sub = add i8 %1, -48
%value = getelementptr inbounds %struct.Card, ptr %t, i64 0, i32 1
store i8 %sub, ptr %value, align 1, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%C1 = alloca [100 x %struct.Card], align 16
%C2 = alloca [100 x %struct.Card], align 16
%N = alloca i32, align 4
%str = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C1) #8
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C2) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #8
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %str) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !19
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.body.lr.ph, label %print.exit
for.body.lr.ph: ; preds = %entry
%arrayidx1.i = getelementptr inbounds i8, ptr %str, i64 1
br label %for.body
for.cond3.preheader: ; preds = %for.body
%cmp478 = icmp sgt i32 %3, 0
br i1 %cmp478, label %for.cond1.preheader.lr.ph.i, label %print.exit
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %str)
%arrayidx = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv
%1 = load i8, ptr %str, align 1, !tbaa !18
store i8 %1, ptr %arrayidx, align 2, !tbaa !14
%2 = load i8, ptr %arrayidx1.i, align 1, !tbaa !18
%sub.i = add i8 %2, -48
%value.i = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 1
store i8 %sub.i, ptr %value.i, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !19
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !21
for.cond1.preheader.lr.ph.i: ; preds = %for.cond3.preheader
%5 = zext i32 %3 to i64
%6 = shl nuw nsw i64 %5, 1
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %C2, ptr nonnull align 16 %C1, i64 %6, i1 false)
%7 = zext i32 %3 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc21.i, %for.cond1.preheader.lr.ph.i
%indvars.iv45.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next46.i, %for.inc21.i ]
br label %for.body3.i
for.body3.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.i = phi i64 [ %7, %for.cond1.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value.i31 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.next.i, i32 1
%8 = load i8, ptr %value.i31, align 1, !tbaa !5
%9 = add nsw i64 %indvars.iv.i, -2
%value7.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %9, i32 1
%10 = load i8, ptr %value7.i, align 1, !tbaa !5
%cmp9.i = icmp slt i8 %8, %10
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %9
%11 = load <2 x i16>, ptr %arrayidx6.i, align 2
%12 = shufflevector <2 x i16> %11, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %12, ptr %arrayidx6.i, align 2
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv45.i
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.inc21.i, !llvm.loop !9
for.inc21.i: ; preds = %for.inc.i
%indvars.iv.next46.i = add nuw nsw i64 %indvars.iv45.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next46.i, %7
br i1 %exitcond.not.i, label %for.cond1.preheader.i33, label %for.cond1.preheader.i, !llvm.loop !11
for.cond1.preheader.i33: ; preds = %for.inc21.i, %for.end.i
%indvars.iv.i34 = phi i64 [ %indvars.iv.next.i37, %for.end.i ], [ 0, %for.inc21.i ]
%13 = trunc i64 %indvars.iv.i34 to i32
br label %for.body3.i35
for.body3.i35: ; preds = %for.body3.i35, %for.cond1.preheader.i33
%indvars.iv41.i = phi i64 [ %indvars.iv.i34, %for.cond1.preheader.i33 ], [ %indvars.iv.next42.i, %for.body3.i35 ]
%minj.038.i = phi i32 [ %13, %for.cond1.preheader.i33 ], [ %spec.select.i, %for.body3.i35 ]
%value.i36 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv41.i, i32 1
%14 = load i8, ptr %value.i36, align 1, !tbaa !5
%idxprom4.i = sext i32 %minj.038.i to i64
%value6.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom4.i, i32 1
%15 = load i8, ptr %value6.i, align 1, !tbaa !5
%cmp8.i = icmp slt i8 %14, %15
%16 = trunc i64 %indvars.iv41.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %16, i32 %minj.038.i
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next42.i, %7
br i1 %cmp2.i, label %for.body3.i35, label %for.end.i, !llvm.loop !12
for.end.i: ; preds = %for.body3.i35
%arrayidx11.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i34
%17 = load i16, ptr %arrayidx11.i, align 2
%idxprom14.i = sext i32 %spec.select.i to i64
%arrayidx15.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom14.i
%18 = load i16, ptr %arrayidx15.i, align 2
store i16 %18, ptr %arrayidx11.i, align 2
store i16 %17, ptr %arrayidx15.i, align 2
%indvars.iv.next.i37 = add nuw nsw i64 %indvars.iv.i34, 1
%exitcond.not.i38 = icmp eq i64 %indvars.iv.next.i37, %7
br i1 %exitcond.not.i38, label %if.end.peel.i, label %for.cond1.preheader.i33, !llvm.loop !13
if.end.peel.i: ; preds = %for.end.i
%value.peel.phi.trans.insert.i = getelementptr inbounds %struct.Card, ptr %C1, i64 0, i32 1
%.pre17.i = load i8, ptr %value.peel.phi.trans.insert.i, align 1, !tbaa !5
%.pre.i = load i8, ptr %C1, align 16, !tbaa !14
%conv.peel.i = sext i8 %.pre.i to i32
%conv4.peel.i = sext i8 %.pre17.i to i32
%call5.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i, i32 noundef %conv4.peel.i)
%exitcond.peel.not.i = icmp eq i32 %3, 1
br i1 %exitcond.peel.not.i, label %print.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i41 = phi i64 [ %indvars.iv.next.i44, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar12.i = call i32 @putchar(i32 32)
%arrayidx.i42 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i41
%19 = load i8, ptr %arrayidx.i42, align 2, !tbaa !14
%conv.i = sext i8 %19 to i32
%value.i43 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i41, i32 1
%20 = load i8, ptr %value.i43, align 1, !tbaa !5
%conv4.i = sext i8 %20 to i32
%call5.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i, i32 noundef %conv4.i)
%indvars.iv.next.i44 = add nuw nsw i64 %indvars.iv.i41, 1
%exitcond.not.i45 = icmp eq i64 %indvars.iv.next.i44, %7
br i1 %exitcond.not.i45, label %print.exit, label %if.end.i, !llvm.loop !15
print.exit: ; preds = %if.end.i, %entry, %for.cond3.preheader, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%21 = load i32, ptr %N, align 4, !tbaa !19
%cmp13.i46 = icmp sgt i32 %21, 0
br i1 %cmp13.i46, label %if.end.peel.i49, label %print.exit68
if.end.peel.i49: ; preds = %print.exit
%wide.trip.count.i50 = zext i32 %21 to i64
%value.peel.phi.trans.insert.i51 = getelementptr inbounds %struct.Card, ptr %C2, i64 0, i32 1
%.pre17.i52 = load i8, ptr %value.peel.phi.trans.insert.i51, align 1, !tbaa !5
%.pre.i53 = load i8, ptr %C2, align 16, !tbaa !14
%conv.peel.i54 = sext i8 %.pre.i53 to i32
%conv4.peel.i55 = sext i8 %.pre17.i52 to i32
%call5.peel.i56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i54, i32 noundef %conv4.peel.i55)
%exitcond.peel.not.i57 = icmp eq i32 %21, 1
br i1 %exitcond.peel.not.i57, label %print.exit68, label %if.end.i58
if.end.i58: ; preds = %if.end.peel.i49, %if.end.i58
%indvars.iv.i59 = phi i64 [ %indvars.iv.next.i66, %if.end.i58 ], [ 1, %if.end.peel.i49 ]
%putchar12.i60 = call i32 @putchar(i32 32)
%arrayidx.i61 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i59
%22 = load i8, ptr %arrayidx.i61, align 2, !tbaa !14
%conv.i62 = sext i8 %22 to i32
%value.i63 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i59, i32 1
%23 = load i8, ptr %value.i63, align 1, !tbaa !5
%conv4.i64 = sext i8 %23 to i32
%call5.i65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i62, i32 noundef %conv4.i64)
%indvars.iv.next.i66 = add nuw nsw i64 %indvars.iv.i59, 1
%exitcond.not.i67 = icmp eq i64 %indvars.iv.next.i66, %wide.trip.count.i50
br i1 %exitcond.not.i67, label %print.exit68, label %if.end.i58, !llvm.loop !15
print.exit68: ; preds = %if.end.i58, %print.exit, %if.end.peel.i49
%putchar.i48 = call i32 @putchar(i32 10)
%24 = load i32, ptr %N, align 4, !tbaa !19
%cmp10.i = icmp sgt i32 %24, 0
br i1 %cmp10.i, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %print.exit68
%wide.trip.count.i69 = zext i32 %24 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i72 = add nuw nsw i64 %indvars.iv.i70, 1
%exitcond.not.i73 = icmp eq i64 %indvars.iv.next.i72, %wide.trip.count.i69
br i1 %exitcond.not.i73, label %if.end, label %for.body.i, !llvm.loop !17
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i70 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i72, %for.cond.i ]
%arrayidx.i71 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i70
%25 = load i8, ptr %arrayidx.i71, align 2, !tbaa !14
%arrayidx2.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i70
%26 = load i8, ptr %arrayidx2.i, align 2, !tbaa !14
%cmp5.not.i = icmp eq i8 %25, %26
br i1 %cmp5.not.i, label %for.cond.i, label %if.end
if.end: ; preds = %for.body.i, %for.cond.i, %print.exit68
%str.7.sink = phi ptr [ @str.8, %print.exit68 ], [ @str.8, %for.cond.i ], [ @str.7, %for.body.i ]
%puts29 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %str) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C2) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C1) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 1}
!6 = !{!"", !7, i64 0, !7, i64 1}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!6, !7, i64 0}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !10}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = distinct !{!21, !10}
|
#include<stdio.h>
typedef struct{
char kind;
int value;
}array;
int main(){
int i,j,minj,a,b,N,flag_S=1,flag_B=1;
array C[36],B[36],S[36],temp;
scanf("%d",&N);
for(i=0;i < N;i++){
scanf(" %c",&C[i].kind);
scanf("%d",&C[i].value);
B[i] = S[i] = C[i];
}
//Bubble
for(i=0;i < N;i++){
for(j=N-1;j > i;j--){
if(B[j].value < B[j-1].value){
temp = B[j];
B[j] = B[j-1];
B[j-1] = temp;
}
}
}
//Select
for(i=0;i < N;i++){
minj = i;
for(j=i;j < N;j++){
if(S[j].value < S[minj].value){
minj = j;
}
}
temp = S[i];
S[i] = S[minj];
S[minj] =temp;
}
//judge of B
for(i=0;i < N;i++){
for(j=i+1;j < N;j++){
for(a=0;a < N;a++){
for(b=a+1;b < N;b++){
if(C[i].value == C[j].value){
if(C[i].value == B[b].value && C[i].kind == B[b].kind){
if (C[j].value == B[a].value && C[j].kind == B[a].kind){
flag_B = 0;
}
}
}
}
}
}
}
//judge of S
for(i=0;i < N;i++){
for(j=i+1;j < N;j++){
for(a=0;a < N;a++){
for(b=a+1;b < N;b++){
if(C[i].value == C[j].value){
if(C[i].value == S[b].value && C[i].kind == S[b].kind){
if (C[j].value == S[a].value && C[j].kind == S[a].kind){
flag_S = 0;
}
}
}
}
}
}
}
for(i=0;i<N;i++){
if(i != 0) printf(" ");
printf("%c%d",B[i].kind,B[i].value);
}
if(flag_B==1) printf("\nStable\n");
else printf("\nNot stable\n");
for(i=0;i < N;i++){
if(i != 0) printf(" ");
printf("%c%d",S[i].kind,S[i].value);
}
if(flag_S==1) printf("\nStable\n");
else printf("\nNot stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113792/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113792/source.c"
target datalayout = "e-m:e-p270: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.array = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %c\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@str.7 = private unnamed_addr constant [12 x i8] c"\0ANot stable\00", align 1
@str.8 = private unnamed_addr constant [8 x i8] c"\0AStable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%C = alloca [36 x %struct.array], align 16
%B = alloca [36 x %struct.array], align 16
%S = alloca [36 x %struct.array], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %C) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp363 = icmp sgt i32 %0, 0
br i1 %cmp363, label %for.body, label %if.end249
for.cond11.preheader: ; preds = %for.body
%cmp12369 = icmp sgt i32 %5, 0
br i1 %cmp12369, label %for.cond14.preheader.lr.ph, label %if.end249
for.cond14.preheader.lr.ph: ; preds = %for.cond11.preheader
%j.0365 = add nsw i32 %5, -1
%1 = zext i32 %5 to i64
%2 = add nsw i64 %1, -1
%3 = zext i32 %j.0365 to i64
%wide.trip.count = zext i32 %5 to i64
br label %for.cond14.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.array], ptr %C, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%value = getelementptr inbounds [36 x %struct.array], ptr %C, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %value)
%arrayidx6 = getelementptr inbounds [36 x %struct.array], ptr %B, i64 0, i64 %indvars.iv
%arrayidx8 = getelementptr inbounds [36 x %struct.array], ptr %S, i64 0, i64 %indvars.iv
%4 = load i64, ptr %arrayidx, align 8
store i64 %4, ptr %arrayidx8, align 8
store i64 %4, ptr %arrayidx6, align 8
%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.cond11.preheader, !llvm.loop !9
for.cond14.preheader: ; preds = %for.cond14.preheader.lr.ph, %for.inc37
%indvars.iv441 = phi i64 [ 0, %for.cond14.preheader.lr.ph ], [ %indvars.iv.next442, %for.inc37 ]
%cmp15366 = icmp ult i64 %indvars.iv441, %3
br i1 %cmp15366, label %for.body16, label %for.inc37
for.cond40.preheader: ; preds = %for.inc37
br i1 %cmp12369, label %for.cond43.preheader.preheader, label %if.end249
for.cond43.preheader.preheader: ; preds = %for.cond40.preheader
%7 = zext i32 %5 to i64
%wide.trip.count450 = zext i32 %5 to i64
br label %for.cond43.preheader
for.body16: ; preds = %for.cond14.preheader, %for.inc35
%indvars.iv435 = phi i64 [ %indvars.iv.next436, %for.inc35 ], [ %1, %for.cond14.preheader ]
%indvars.iv433 = phi i64 [ %indvars.iv.next434, %for.inc35 ], [ %2, %for.cond14.preheader ]
%indvars.iv.next436 = add nsw i64 %indvars.iv435, -1
%value19 = getelementptr inbounds [36 x %struct.array], ptr %B, i64 0, i64 %indvars.iv433, i32 1
%8 = load i32, ptr %value19, align 4, !tbaa !11
%9 = add nsw i64 %indvars.iv435, -2
%value23 = getelementptr inbounds [36 x %struct.array], ptr %B, i64 0, i64 %9, i32 1
%10 = load i32, ptr %value23, align 4, !tbaa !11
%cmp24 = icmp slt i32 %8, %10
br i1 %cmp24, label %if.then, label %for.inc35
if.then: ; preds = %for.body16
%arrayidx22 = getelementptr inbounds [36 x %struct.array], ptr %B, i64 0, i64 %9
%arrayidx18 = getelementptr inbounds [36 x %struct.array], ptr %B, i64 0, i64 %indvars.iv433
%11 = load i64, ptr %arrayidx18, align 8
%12 = load i64, ptr %arrayidx22, align 8
store i64 %12, ptr %arrayidx18, align 8
store i64 %11, ptr %arrayidx22, align 8
br label %for.inc35
for.inc35: ; preds = %for.body16, %if.then
%indvars.iv.next434 = add nsw i64 %indvars.iv433, -1
%cmp15 = icmp sgt i64 %indvars.iv.next434, %indvars.iv441
br i1 %cmp15, label %for.body16, label %for.inc37, !llvm.loop !13
for.inc37: ; preds = %for.inc35, %for.cond14.preheader
%indvars.iv.next442 = add nuw nsw i64 %indvars.iv441, 1
%exitcond.not = icmp eq i64 %indvars.iv.next442, %wide.trip.count
br i1 %exitcond.not, label %for.cond40.preheader, label %for.cond14.preheader, !llvm.loop !14
for.cond43.preheader: ; preds = %for.cond43.preheader.preheader, %for.end57
%indvars.iv444 = phi i64 [ 0, %for.cond43.preheader.preheader ], [ %indvars.iv.next445, %for.end57 ]
%13 = trunc i64 %indvars.iv444 to i32
br label %for.body45
for.cond69.preheader: ; preds = %for.end57
br i1 %cmp12369, label %for.body71.us.preheader, label %if.end249
for.body71.us.preheader: ; preds = %for.cond69.preheader
%14 = zext i32 %5 to i64
%wide.trip.count474 = zext i32 %5 to i64
br label %for.body71.us
for.body71.us: ; preds = %for.body71.us.preheader, %for.cond69.loopexit.us
%indvars.iv471 = phi i64 [ 0, %for.body71.us.preheader ], [ %indvars.iv.next472, %for.cond69.loopexit.us ]
%indvars.iv464 = phi i64 [ 1, %for.body71.us.preheader ], [ %indvars.iv.next465, %for.cond69.loopexit.us ]
%flag_B.0396.us = phi i32 [ 1, %for.body71.us.preheader ], [ %flag_B.1.lcssa.us, %for.cond69.loopexit.us ]
%indvars.iv.next472 = add nuw nsw i64 %indvars.iv471, 1
%cmp73383.us = icmp ult i64 %indvars.iv.next472, %14
br i1 %cmp73383.us, label %for.cond75.preheader.lr.ph.us, label %for.cond69.loopexit.us
for.cond69.loopexit.us: ; preds = %for.cond75.for.inc136_crit_edge.us.us, %for.body71.us
%flag_B.1.lcssa.us = phi i32 [ %flag_B.0396.us, %for.body71.us ], [ %flag_B.3.lcssa.us.us, %for.cond75.for.inc136_crit_edge.us.us ]
%indvars.iv.next465 = add nuw nsw i64 %indvars.iv464, 1
%exitcond475.not = icmp eq i64 %indvars.iv.next472, %wide.trip.count474
br i1 %exitcond475.not, label %for.cond142.preheader, label %for.body71.us, !llvm.loop !15
for.cond75.preheader.lr.ph.us: ; preds = %for.body71.us
%arrayidx83.us = getelementptr inbounds [36 x %struct.array], ptr %C, i64 0, i64 %indvars.iv471
%value84.us = getelementptr inbounds [36 x %struct.array], ptr %C, i64 0, i64 %indvars.iv471, i32 1
br label %for.cond75.preheader.us.us
for.cond75.preheader.us.us: ; preds = %for.cond75.for.inc136_crit_edge.us.us, %for.cond75.preheader.lr.ph.us
%indvars.iv466 = phi i64 [ %indvars.iv.next467, %for.cond75.for.inc136_crit_edge.us.us ], [ %indvars.iv464, %for.cond75.preheader.lr.ph.us ]
%flag_B.1385.us.us = phi i32 [ %flag_B.3.lcssa.us.us, %for.cond75.for.inc136_crit_edge.us.us ], [ %flag_B.0396.us, %for.cond75.preheader.lr.ph.us ]
%arrayidx86.us.us = getelementptr inbounds [36 x %struct.array], ptr %C, i64 0, i64 %indvars.iv466
%value87.us.us = getelementptr inbounds [36 x %struct.array], ptr %C, i64 0, i64 %indvars.iv466, i32 1
br label %for.body77.us.us
for.body77.us.us: ; preds = %for.cond75.loopexit.us.us, %for.cond75.preheader.us.us
%indvars.iv459 = phi i64 [ %indvars.iv.next460, %for.cond75.loopexit.us.us ], [ 0, %for.cond75.preheader.us.us ]
%indvars.iv452 = phi i64 [ %indvars.iv.next453, %for.cond75.loopexit.us.us ], [ 1, %for.cond75.preheader.us.us ]
%flag_B.2381.us.us = phi i32 [ %flag_B.3.lcssa.us.us, %for.cond75.loopexit.us.us ], [ %flag_B.1385.us.us, %for.cond75.preheader.us.us ]
%indvars.iv.next460 = add nuw nsw i64 %indvars.iv459, 1
%cmp80375.us.us = icmp ult i64 %indvars.iv.next460, %14
br i1 %cmp80375.us.us, label %for.body81.lr.ph.us.us, label %for.cond75.loopexit.us.us
for.cond75.loopexit.us.us: ; preds = %for.inc130.us.us.us, %for.body81.lr.ph.us.us, %for.body77.us.us
%flag_B.3.lcssa.us.us = phi i32 [ %flag_B.2381.us.us, %for.body77.us.us ], [ %flag_B.2381.us.us, %for.body81.lr.ph.us.us ], [ %flag_B.4.us.us.us, %for.inc130.us.us.us ]
%indvars.iv.next453 = add nuw nsw i64 %indvars.iv452, 1
%exitcond463.not = icmp eq i64 %indvars.iv.next460, %wide.trip.count474
br i1 %exitcond463.not, label %for.cond75.for.inc136_crit_edge.us.us, label %for.body77.us.us, !llvm.loop !16
for.body81.lr.ph.us.us: ; preds = %for.body77.us.us
%15 = load i32, ptr %value84.us, align 4, !tbaa !11
%16 = load i32, ptr %value87.us.us, align 4, !tbaa !11
%cmp88.us.us = icmp eq i32 %15, %16
%value112.us.us = getelementptr inbounds [36 x %struct.array], ptr %B, i64 0, i64 %indvars.iv459, i32 1
%arrayidx111.us.us = getelementptr inbounds [36 x %struct.array], ptr %B, i64 0, i64 %indvars.iv459
br i1 %cmp88.us.us, label %for.body81.us.us.us, label %for.cond75.loopexit.us.us
for.body81.us.us.us: ; preds = %for.body81.lr.ph.us.us, %for.inc130.us.us.us
%indvars.iv454 = phi i64 [ %indvars.iv.next455, %for.inc130.us.us.us ], [ %indvars.iv452, %for.body81.lr.ph.us.us ]
%flag_B.3377.us.us.us = phi i32 [ %flag_B.4.us.us.us, %for.inc130.us.us.us ], [ %flag_B.2381.us.us, %for.body81.lr.ph.us.us ]
%value95.us.us.us = getelementptr inbounds [36 x %struct.array], ptr %B, i64 0, i64 %indvars.iv454, i32 1
%17 = load i32, ptr %value95.us.us.us, align 4, !tbaa !11
%cmp96.us.us.us = icmp eq i32 %15, %17
br i1 %cmp96.us.us.us, label %land.lhs.true.us.us.us, label %for.inc130.us.us.us
land.lhs.true.us.us.us: ; preds = %for.body81.us.us.us
%arrayidx94.us.us.us = getelementptr inbounds [36 x %struct.array], ptr %B, i64 0, i64 %indvars.iv454
%18 = load i8, ptr %arrayidx83.us, align 8, !tbaa !17
%19 = load i8, ptr %arrayidx94.us.us.us, align 8, !tbaa !17
%cmp104.us.us.us = icmp eq i8 %18, %19
br i1 %cmp104.us.us.us, label %if.then106.us.us.us, label %for.inc130.us.us.us
if.then106.us.us.us: ; preds = %land.lhs.true.us.us.us
%20 = load i32, ptr %value112.us.us, align 4, !tbaa !11
%cmp113.us.us.us = icmp eq i32 %15, %20
br i1 %cmp113.us.us.us, label %land.lhs.true115.us.us.us, label %for.inc130.us.us.us
land.lhs.true115.us.us.us: ; preds = %if.then106.us.us.us
%21 = load i8, ptr %arrayidx86.us.us, align 8, !tbaa !17
%22 = load i8, ptr %arrayidx111.us.us, align 8, !tbaa !17
%cmp124.us.us.us = icmp eq i8 %21, %22
%spec.select361.us.us.us = select i1 %cmp124.us.us.us, i32 0, i32 %flag_B.3377.us.us.us
br label %for.inc130.us.us.us
for.inc130.us.us.us: ; preds = %land.lhs.true115.us.us.us, %if.then106.us.us.us, %land.lhs.true.us.us.us, %for.body81.us.us.us
%flag_B.4.us.us.us = phi i32 [ %flag_B.3377.us.us.us, %if.then106.us.us.us ], [ %flag_B.3377.us.us.us, %land.lhs.true.us.us.us ], [ %flag_B.3377.us.us.us, %for.body81.us.us.us ], [ %spec.select361.us.us.us, %land.lhs.true115.us.us.us ]
%indvars.iv.next455 = add nuw nsw i64 %indvars.iv454, 1
%exitcond458.not = icmp eq i64 %indvars.iv.next455, %wide.trip.count474
br i1 %exitcond458.not, label %for.cond75.loopexit.us.us, label %for.body81.us.us.us, !llvm.loop !18
for.cond75.for.inc136_crit_edge.us.us: ; preds = %for.cond75.loopexit.us.us
%indvars.iv.next467 = add nuw nsw i64 %indvars.iv466, 1
%exitcond470.not = icmp eq i64 %indvars.iv.next467, %wide.trip.count474
br i1 %exitcond470.not, label %for.cond69.loopexit.us, label %for.cond75.preheader.us.us, !llvm.loop !19
for.body45: ; preds = %for.cond43.preheader, %for.body45
%indvars.iv446 = phi i64 [ %indvars.iv444, %for.cond43.preheader ], [ %indvars.iv.next447, %for.body45 ]
%minj.0372 = phi i32 [ %13, %for.cond43.preheader ], [ %spec.select, %for.body45 ]
%value48 = getelementptr inbounds [36 x %struct.array], ptr %S, i64 0, i64 %indvars.iv446, i32 1
%23 = load i32, ptr %value48, align 4, !tbaa !11
%idxprom49 = sext i32 %minj.0372 to i64
%value51 = getelementptr inbounds [36 x %struct.array], ptr %S, i64 0, i64 %idxprom49, i32 1
%24 = load i32, ptr %value51, align 4, !tbaa !11
%cmp52 = icmp slt i32 %23, %24
%25 = trunc i64 %indvars.iv446 to i32
%spec.select = select i1 %cmp52, i32 %25, i32 %minj.0372
%indvars.iv.next447 = add nuw nsw i64 %indvars.iv446, 1
%cmp44 = icmp ult i64 %indvars.iv.next447, %7
br i1 %cmp44, label %for.body45, label %for.end57, !llvm.loop !20
for.end57: ; preds = %for.body45
%arrayidx59 = getelementptr inbounds [36 x %struct.array], ptr %S, i64 0, i64 %indvars.iv444
%26 = load i64, ptr %arrayidx59, align 8
%idxprom62 = sext i32 %spec.select to i64
%arrayidx63 = getelementptr inbounds [36 x %struct.array], ptr %S, i64 0, i64 %idxprom62
%27 = load i64, ptr %arrayidx63, align 8
store i64 %27, ptr %arrayidx59, align 8
store i64 %26, ptr %arrayidx63, align 8
%indvars.iv.next445 = add nuw nsw i64 %indvars.iv444, 1
%exitcond451.not = icmp eq i64 %indvars.iv.next445, %wide.trip.count450
br i1 %exitcond451.not, label %for.cond69.preheader, label %for.cond43.preheader, !llvm.loop !21
for.cond142.preheader: ; preds = %for.cond69.loopexit.us
br i1 %cmp12369, label %for.body145.us.preheader, label %for.end243
for.body145.us.preheader: ; preds = %for.cond142.preheader
%28 = zext i32 %5 to i64
%wide.trip.count498 = zext i32 %5 to i64
br label %for.body145.us
for.body145.us: ; preds = %for.body145.us.preheader, %for.cond142.loopexit.us
%indvars.iv495 = phi i64 [ 0, %for.body145.us.preheader ], [ %indvars.iv.next496, %for.cond142.loopexit.us ]
%indvars.iv488 = phi i64 [ 1, %for.body145.us.preheader ], [ %indvars.iv.next489, %for.cond142.loopexit.us ]
%flag_S.0420.us = phi i32 [ 1, %for.body145.us.preheader ], [ %flag_S.1.lcssa.us, %for.cond142.loopexit.us ]
%indvars.iv.next496 = add nuw nsw i64 %indvars.iv495, 1
%cmp148407.us = icmp ult i64 %indvars.iv.next496, %28
br i1 %cmp148407.us, label %for.cond151.preheader.lr.ph.us, label %for.cond142.loopexit.us
for.cond142.loopexit.us: ; preds = %for.cond151.for.inc218_crit_edge.us.us, %for.body145.us
%flag_S.1.lcssa.us = phi i32 [ %flag_S.0420.us, %for.body145.us ], [ %flag_S.3.lcssa.us.us, %for.cond151.for.inc218_crit_edge.us.us ]
%indvars.iv.next489 = add nuw nsw i64 %indvars.iv488, 1
%exitcond499.not = icmp eq i64 %indvars.iv.next496, %wide.trip.count498
br i1 %exitcond499.not, label %for.cond224.preheader, label %for.body145.us, !llvm.loop !22
for.cond151.preheader.lr.ph.us: ; preds = %for.body145.us
%arrayidx161.us = getelementptr inbounds [36 x %struct.array], ptr %C, i64 0, i64 %indvars.iv495
%value162.us = getelementptr inbounds [36 x %struct.array], ptr %C, i64 0, i64 %indvars.iv495, i32 1
br label %for.cond151.preheader.us.us
for.cond151.preheader.us.us: ; preds = %for.cond151.for.inc218_crit_edge.us.us, %for.cond151.preheader.lr.ph.us
%indvars.iv490 = phi i64 [ %indvars.iv.next491, %for.cond151.for.inc218_crit_edge.us.us ], [ %indvars.iv488, %for.cond151.preheader.lr.ph.us ]
%flag_S.1409.us.us = phi i32 [ %flag_S.3.lcssa.us.us, %for.cond151.for.inc218_crit_edge.us.us ], [ %flag_S.0420.us, %for.cond151.preheader.lr.ph.us ]
%arrayidx164.us.us = getelementptr inbounds [36 x %struct.array], ptr %C, i64 0, i64 %indvars.iv490
%value165.us.us = getelementptr inbounds [36 x %struct.array], ptr %C, i64 0, i64 %indvars.iv490, i32 1
br label %for.body154.us.us
for.body154.us.us: ; preds = %for.cond151.loopexit.us.us, %for.cond151.preheader.us.us
%indvars.iv483 = phi i64 [ %indvars.iv.next484, %for.cond151.loopexit.us.us ], [ 0, %for.cond151.preheader.us.us ]
%indvars.iv476 = phi i64 [ %indvars.iv.next477, %for.cond151.loopexit.us.us ], [ 1, %for.cond151.preheader.us.us ]
%flag_S.2405.us.us = phi i32 [ %flag_S.3.lcssa.us.us, %for.cond151.loopexit.us.us ], [ %flag_S.1409.us.us, %for.cond151.preheader.us.us ]
%indvars.iv.next484 = add nuw nsw i64 %indvars.iv483, 1
%cmp157398.us.us = icmp ult i64 %indvars.iv.next484, %28
br i1 %cmp157398.us.us, label %for.body159.lr.ph.us.us, label %for.cond151.loopexit.us.us
for.cond151.loopexit.us.us: ; preds = %for.inc212.us.us.us, %for.body159.lr.ph.us.us, %for.body154.us.us
%flag_S.3.lcssa.us.us = phi i32 [ %flag_S.2405.us.us, %for.body154.us.us ], [ %flag_S.2405.us.us, %for.body159.lr.ph.us.us ], [ %flag_S.4.us.us.us, %for.inc212.us.us.us ]
%indvars.iv.next477 = add nuw nsw i64 %indvars.iv476, 1
%exitcond487.not = icmp eq i64 %indvars.iv.next484, %wide.trip.count498
br i1 %exitcond487.not, label %for.cond151.for.inc218_crit_edge.us.us, label %for.body154.us.us, !llvm.loop !23
for.body159.lr.ph.us.us: ; preds = %for.body154.us.us
%29 = load i32, ptr %value162.us, align 4, !tbaa !11
%30 = load i32, ptr %value165.us.us, align 4, !tbaa !11
%cmp166.us.us = icmp eq i32 %29, %30
%value194.us.us = getelementptr inbounds [36 x %struct.array], ptr %S, i64 0, i64 %indvars.iv483, i32 1
%arrayidx193.us.us = getelementptr inbounds [36 x %struct.array], ptr %S, i64 0, i64 %indvars.iv483
br i1 %cmp166.us.us, label %for.body159.us.us.us, label %for.cond151.loopexit.us.us
for.body159.us.us.us: ; preds = %for.body159.lr.ph.us.us, %for.inc212.us.us.us
%indvars.iv478 = phi i64 [ %indvars.iv.next479, %for.inc212.us.us.us ], [ %indvars.iv476, %for.body159.lr.ph.us.us ]
%flag_S.3400.us.us.us = phi i32 [ %flag_S.4.us.us.us, %for.inc212.us.us.us ], [ %flag_S.2405.us.us, %for.body159.lr.ph.us.us ]
%value174.us.us.us = getelementptr inbounds [36 x %struct.array], ptr %S, i64 0, i64 %indvars.iv478, i32 1
%31 = load i32, ptr %value174.us.us.us, align 4, !tbaa !11
%cmp175.us.us.us = icmp eq i32 %29, %31
br i1 %cmp175.us.us.us, label %land.lhs.true177.us.us.us, label %for.inc212.us.us.us
land.lhs.true177.us.us.us: ; preds = %for.body159.us.us.us
%arrayidx173.us.us.us = getelementptr inbounds [36 x %struct.array], ptr %S, i64 0, i64 %indvars.iv478
%32 = load i8, ptr %arrayidx161.us, align 8, !tbaa !17
%33 = load i8, ptr %arrayidx173.us.us.us, align 8, !tbaa !17
%cmp186.us.us.us = icmp eq i8 %32, %33
br i1 %cmp186.us.us.us, label %if.then188.us.us.us, label %for.inc212.us.us.us
if.then188.us.us.us: ; preds = %land.lhs.true177.us.us.us
%34 = load i32, ptr %value194.us.us, align 4, !tbaa !11
%cmp195.us.us.us = icmp eq i32 %29, %34
br i1 %cmp195.us.us.us, label %land.lhs.true197.us.us.us, label %for.inc212.us.us.us
land.lhs.true197.us.us.us: ; preds = %if.then188.us.us.us
%35 = load i8, ptr %arrayidx164.us.us, align 8, !tbaa !17
%36 = load i8, ptr %arrayidx193.us.us, align 8, !tbaa !17
%cmp206.us.us.us = icmp eq i8 %35, %36
%spec.select362.us.us.us = select i1 %cmp206.us.us.us, i32 0, i32 %flag_S.3400.us.us.us
br label %for.inc212.us.us.us
for.inc212.us.us.us: ; preds = %land.lhs.true197.us.us.us, %if.then188.us.us.us, %land.lhs.true177.us.us.us, %for.body159.us.us.us
%flag_S.4.us.us.us = phi i32 [ %flag_S.3400.us.us.us, %if.then188.us.us.us ], [ %flag_S.3400.us.us.us, %land.lhs.true177.us.us.us ], [ %flag_S.3400.us.us.us, %for.body159.us.us.us ], [ %spec.select362.us.us.us, %land.lhs.true197.us.us.us ]
%indvars.iv.next479 = add nuw nsw i64 %indvars.iv478, 1
%exitcond482.not = icmp eq i64 %indvars.iv.next479, %wide.trip.count498
br i1 %exitcond482.not, label %for.cond151.loopexit.us.us, label %for.body159.us.us.us, !llvm.loop !24
for.cond151.for.inc218_crit_edge.us.us: ; preds = %for.cond151.loopexit.us.us
%indvars.iv.next491 = add nuw nsw i64 %indvars.iv490, 1
%exitcond494.not = icmp eq i64 %indvars.iv.next491, %wide.trip.count498
br i1 %exitcond494.not, label %for.cond142.loopexit.us, label %for.cond151.preheader.us.us, !llvm.loop !25
for.cond224.preheader: ; preds = %for.cond142.loopexit.us
%37 = icmp eq i32 %flag_S.1.lcssa.us, 1
br i1 %cmp12369, label %if.end232.peel, label %for.end243
if.end232.peel: ; preds = %for.cond224.preheader
%38 = load i8, ptr %B, align 16, !tbaa !17
%conv236.peel = sext i8 %38 to i32
%value239.peel = getelementptr inbounds [36 x %struct.array], ptr %B, i64 0, i64 0, i32 1
%39 = load i32, ptr %value239.peel, align 4, !tbaa !11
%call240.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv236.peel, i32 noundef %39)
%40 = load i32, ptr %N, align 4, !tbaa !5
%cmp225.peel = icmp sgt i32 %40, 1
br i1 %cmp225.peel, label %if.end232, label %for.end243
if.end232: ; preds = %if.end232.peel, %if.end232
%indvars.iv500 = phi i64 [ %indvars.iv.next501, %if.end232 ], [ 1, %if.end232.peel ]
%putchar360 = call i32 @putchar(i32 32)
%arrayidx234 = getelementptr inbounds [36 x %struct.array], ptr %B, i64 0, i64 %indvars.iv500
%41 = load i8, ptr %arrayidx234, align 8, !tbaa !17
%conv236 = sext i8 %41 to i32
%value239 = getelementptr inbounds [36 x %struct.array], ptr %B, i64 0, i64 %indvars.iv500, i32 1
%42 = load i32, ptr %value239, align 4, !tbaa !11
%call240 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv236, i32 noundef %42)
%indvars.iv.next501 = add nuw nsw i64 %indvars.iv500, 1
%43 = load i32, ptr %N, align 4, !tbaa !5
%44 = sext i32 %43 to i64
%cmp225 = icmp slt i64 %indvars.iv.next501, %44
br i1 %cmp225, label %if.end232, label %for.end243, !llvm.loop !26
for.end243: ; preds = %if.end232, %for.cond142.preheader, %if.end232.peel, %for.cond224.preheader
%flag_S.0.lcssa524 = phi i1 [ %37, %for.cond224.preheader ], [ %37, %if.end232.peel ], [ true, %for.cond142.preheader ], [ %37, %if.end232 ]
%cmp244 = icmp eq i32 %flag_B.1.lcssa.us, 1
%spec.select530 = select i1 %cmp244, ptr @str.8, ptr @str.7
%45 = select i1 %flag_S.0.lcssa524, ptr @str.8, ptr @str.7
br label %if.end249
if.end249: ; preds = %for.end243, %for.cond69.preheader, %for.cond40.preheader, %for.cond11.preheader, %entry
%str.sink = phi ptr [ @str.8, %entry ], [ @str.8, %for.cond11.preheader ], [ @str.8, %for.cond40.preheader ], [ @str.8, %for.cond69.preheader ], [ %spec.select530, %for.end243 ]
%flag_S.0.lcssa524528 = phi ptr [ @str.8, %entry ], [ @str.8, %for.cond11.preheader ], [ @str.8, %for.cond40.preheader ], [ @str.8, %for.cond69.preheader ], [ %45, %for.end243 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%46 = load i32, ptr %N, align 4, !tbaa !5
%cmp251425 = icmp sgt i32 %46, 0
br i1 %cmp251425, label %if.end258.peel, label %for.end269
if.end258.peel: ; preds = %if.end249
%47 = load i8, ptr %S, align 16, !tbaa !17
%conv262.peel = sext i8 %47 to i32
%value265.peel = getelementptr inbounds [36 x %struct.array], ptr %S, i64 0, i64 0, i32 1
%48 = load i32, ptr %value265.peel, align 4, !tbaa !11
%call266.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv262.peel, i32 noundef %48)
%49 = load i32, ptr %N, align 4, !tbaa !5
%cmp251.peel = icmp sgt i32 %49, 1
br i1 %cmp251.peel, label %if.end258, label %for.end269
if.end258: ; preds = %if.end258.peel, %if.end258
%indvars.iv504 = phi i64 [ %indvars.iv.next505, %if.end258 ], [ 1, %if.end258.peel ]
%putchar = call i32 @putchar(i32 32)
%arrayidx260 = getelementptr inbounds [36 x %struct.array], ptr %S, i64 0, i64 %indvars.iv504
%50 = load i8, ptr %arrayidx260, align 8, !tbaa !17
%conv262 = sext i8 %50 to i32
%value265 = getelementptr inbounds [36 x %struct.array], ptr %S, i64 0, i64 %indvars.iv504, i32 1
%51 = load i32, ptr %value265, align 4, !tbaa !11
%call266 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv262, i32 noundef %51)
%indvars.iv.next505 = add nuw nsw i64 %indvars.iv504, 1
%52 = load i32, ptr %N, align 4, !tbaa !5
%53 = sext i32 %52 to i64
%cmp251 = icmp slt i64 %indvars.iv.next505, %53
br i1 %cmp251, label %if.end258, label %for.end269, !llvm.loop !28
for.end269: ; preds = %if.end258, %if.end258.peel, %if.end249
%puts358 = call i32 @puts(ptr nonnull dereferenceable(1) %flag_S.0.lcssa524528)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %S) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; 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 = !{!12, !6, i64 4}
!12 = !{!"", !7, i64 0, !6, i64 4}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!12, !7, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10, !27}
!27 = !{!"llvm.loop.peeled.count", i32 1}
!28 = distinct !{!28, !10, !27}
|
#include <stdio.h>
#include <stdlib.h>
struct Card{
char EGARA;
int NUM;
};
void BubbleSort(struct Card *);
void SelectionSort(struct Card *);
int isStable(struct Card *,struct Card *);
void print(struct Card *);
int n;
int main(){
int i;
struct Card A[1000], B[1000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf(" %c",&A[i].EGARA);
scanf("%d",&A[i].NUM);
}
for(i=0;i<n;i++){
B[i]=A[i];
}
BubbleSort(A);
SelectionSort(B);
print(A);
printf("Stable\n");
print(B);
if(isStable(A,B)==1)
printf("Stable\n");
else
printf("Not stable\n");
return 0;
}
void BubbleSort(struct Card *A){
int i,j;
struct Card m;
for(i=0;i<n;i++){
for(j=n-1;j>=i+1;j--){
if(A[j].NUM<A[j-1].NUM){
m=A[j];
A[j]=A[j-1];
A[j-1]=m;
}
}
}
}
void SelectionSort(struct Card *B){
int i,minj,j;
struct Card m;
for(i=0;i<n;i++){
minj=i;
for(j=i;j<n;j++){
if(B[j].NUM<B[minj].NUM){
minj=j;
}
}
m=B[i];
B[i]=B[minj];
B[minj]=m;
}
}
void print(struct Card *A){
int i;
for(i=0;i<n;i++){
if(i>0)
printf(" ");
printf("%c%d",A[i].EGARA,A[i].NUM);
}
printf("\n");
}
int isStable(struct Card *A,struct Card *B){
int i;
for(i=0;i<n;i++){
if(A[i].EGARA!=B[i].EGARA)
return 0;
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113835/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113835/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Card = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [4 x i8] c" %c\00", align 1
@.str.5 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [1000 x %struct.Card], align 16
%B = alloca [1000 x %struct.Card], align 16
call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %A) #7
call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %B) #7
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp73 = icmp sgt i32 %0, 0
br i1 %cmp73, label %for.body, label %print.exit
for.cond5.preheader: ; preds = %for.body
%cmp675 = icmp sgt i32 %1, 0
br i1 %cmp675, label %for.cond1.preheader.lr.ph.i, label %print.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x %struct.Card], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%NUM = getelementptr inbounds [1000 x %struct.Card], ptr %A, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %NUM)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.cond1.preheader.lr.ph.i: ; preds = %for.cond5.preheader
%3 = zext i32 %1 to i64
%4 = shl nuw nsw i64 %3, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %B, ptr nonnull align 16 %A, i64 %4, i1 false)
%5 = zext i32 %1 to i64
br label %for.cond1.preheader.i
for.cond.loopexit.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%exitcond.not.i = icmp eq i64 %indvars.iv.next44.i, %5
br i1 %exitcond.not.i, label %for.cond1.preheader.i35, label %for.cond1.preheader.i, !llvm.loop !11
for.cond1.preheader.i: ; preds = %for.cond.loopexit.i, %for.cond1.preheader.lr.ph.i
%indvars.iv43.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next44.i, %for.cond.loopexit.i ]
%indvars.iv.next44.i = add nuw nsw i64 %indvars.iv43.i, 1
%cmp2.not.not36.i = icmp ult i64 %indvars.iv.next44.i, %5
br i1 %cmp2.not.not36.i, label %for.body3.i, label %for.cond.loopexit.i
for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %5, %for.cond1.preheader.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%NUM.i = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next.i, i32 1
%6 = load i32, ptr %NUM.i, align 4, !tbaa !12
%7 = add nsw i64 %indvars.iv.i, -2
%NUM7.i = getelementptr inbounds %struct.Card, ptr %A, i64 %7, i32 1
%8 = load i32, ptr %NUM7.i, align 4, !tbaa !12
%cmp8.i = icmp slt i32 %6, %8
br i1 %cmp8.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.Card, ptr %A, i64 %7
%9 = load <2 x i64>, ptr %arrayidx6.i, align 8
%10 = shufflevector <2 x i64> %9, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %10, ptr %arrayidx6.i, align 8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv.next44.i
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.cond.loopexit.i, !llvm.loop !14
for.cond1.preheader.i35: ; preds = %for.cond.loopexit.i, %for.end.i
%indvars.iv.i36 = phi i64 [ %indvars.iv.next.i39, %for.end.i ], [ 0, %for.cond.loopexit.i ]
%11 = trunc i64 %indvars.iv.i36 to i32
br label %for.body3.i37
for.body3.i37: ; preds = %for.body3.i37, %for.cond1.preheader.i35
%indvars.iv38.i = phi i64 [ %indvars.iv.i36, %for.cond1.preheader.i35 ], [ %indvars.iv.next39.i, %for.body3.i37 ]
%minj.034.i = phi i32 [ %11, %for.cond1.preheader.i35 ], [ %spec.select.i, %for.body3.i37 ]
%NUM.i38 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv38.i, i32 1
%12 = load i32, ptr %NUM.i38, align 4, !tbaa !12
%idxprom4.i = sext i32 %minj.034.i to i64
%NUM6.i = getelementptr inbounds %struct.Card, ptr %B, i64 %idxprom4.i, i32 1
%13 = load i32, ptr %NUM6.i, align 4, !tbaa !12
%cmp7.i = icmp slt i32 %12, %13
%14 = trunc i64 %indvars.iv38.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %14, i32 %minj.034.i
%indvars.iv.next39.i = add nuw nsw i64 %indvars.iv38.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next39.i, %5
br i1 %cmp2.i, label %for.body3.i37, label %for.end.i, !llvm.loop !15
for.end.i: ; preds = %for.body3.i37
%arrayidx9.i = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.i36
%15 = load i64, ptr %arrayidx9.i, align 8
%idxprom12.i = sext i32 %spec.select.i to i64
%arrayidx13.i = getelementptr inbounds %struct.Card, ptr %B, i64 %idxprom12.i
%16 = load i64, ptr %arrayidx13.i, align 8
store i64 %16, ptr %arrayidx9.i, align 8
store i64 %15, ptr %arrayidx13.i, align 8
%indvars.iv.next.i39 = add nuw nsw i64 %indvars.iv.i36, 1
%exitcond.not.i40 = icmp eq i64 %indvars.iv.next.i39, %5
br i1 %exitcond.not.i40, label %if.end.peel.i, label %for.cond1.preheader.i35, !llvm.loop !16
if.end.peel.i: ; preds = %for.end.i
%NUM.peel.phi.trans.insert.i = getelementptr inbounds %struct.Card, ptr %A, i64 0, i32 1
%.pre16.i = load i32, ptr %NUM.peel.phi.trans.insert.i, align 4, !tbaa !12
%.pre.i = load i8, ptr %A, align 16, !tbaa !17
%conv.peel.i = sext i8 %.pre.i to i32
%call4.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv.peel.i, i32 noundef %.pre16.i)
%17 = load i32, ptr @n, align 4, !tbaa !5
%cmp.peel.i = icmp sgt i32 %17, 1
br i1 %cmp.peel.i, label %if.end.i, label %print.exit
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i42 = phi i64 [ %indvars.iv.next.i45, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar11.i = call i32 @putchar(i32 32)
%arrayidx.i43 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.i42
%18 = load i8, ptr %arrayidx.i43, align 8, !tbaa !17
%conv.i = sext i8 %18 to i32
%NUM.i44 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.i42, i32 1
%19 = load i32, ptr %NUM.i44, align 4, !tbaa !12
%call4.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv.i, i32 noundef %19)
%indvars.iv.next.i45 = add nuw nsw i64 %indvars.iv.i42, 1
%20 = load i32, ptr @n, align 4, !tbaa !5
%21 = sext i32 %20 to i64
%cmp.i = icmp slt i64 %indvars.iv.next.i45, %21
br i1 %cmp.i, label %if.end.i, label %print.exit, !llvm.loop !18
print.exit: ; preds = %if.end.i, %entry, %for.cond5.preheader, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%22 = load i32, ptr @n, align 4, !tbaa !5
%cmp12.i46 = icmp sgt i32 %22, 0
br i1 %cmp12.i46, label %if.end.peel.i49, label %print.exit65
if.end.peel.i49: ; preds = %print.exit
%NUM.peel.phi.trans.insert.i50 = getelementptr inbounds %struct.Card, ptr %B, i64 0, i32 1
%.pre16.i51 = load i32, ptr %NUM.peel.phi.trans.insert.i50, align 4, !tbaa !12
%.pre.i52 = load i8, ptr %B, align 16, !tbaa !17
%conv.peel.i53 = sext i8 %.pre.i52 to i32
%call4.peel.i54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv.peel.i53, i32 noundef %.pre16.i51)
%23 = load i32, ptr @n, align 4, !tbaa !5
%cmp.peel.i55 = icmp sgt i32 %23, 1
br i1 %cmp.peel.i55, label %if.end.i56, label %print.exit65
if.end.i56: ; preds = %if.end.peel.i49, %if.end.i56
%indvars.iv.i57 = phi i64 [ %indvars.iv.next.i63, %if.end.i56 ], [ 1, %if.end.peel.i49 ]
%putchar11.i58 = call i32 @putchar(i32 32)
%arrayidx.i59 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.i57
%24 = load i8, ptr %arrayidx.i59, align 8, !tbaa !17
%conv.i60 = sext i8 %24 to i32
%NUM.i61 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.i57, i32 1
%25 = load i32, ptr %NUM.i61, align 4, !tbaa !12
%call4.i62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv.i60, i32 noundef %25)
%indvars.iv.next.i63 = add nuw nsw i64 %indvars.iv.i57, 1
%26 = load i32, ptr @n, align 4, !tbaa !5
%27 = sext i32 %26 to i64
%cmp.i64 = icmp slt i64 %indvars.iv.next.i63, %27
br i1 %cmp.i64, label %if.end.i56, label %print.exit65, !llvm.loop !18
print.exit65: ; preds = %if.end.i56, %print.exit, %if.end.peel.i49
%putchar.i48 = call i32 @putchar(i32 10)
%28 = load i32, ptr @n, align 4, !tbaa !5
%cmp10.i = icmp sgt i32 %28, 0
br i1 %cmp10.i, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %print.exit65
%wide.trip.count.i66 = zext i32 %28 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i69 = add nuw nsw i64 %indvars.iv.i67, 1
%exitcond.not.i70 = icmp eq i64 %indvars.iv.next.i69, %wide.trip.count.i66
br i1 %exitcond.not.i70, label %if.end, label %for.body.i, !llvm.loop !20
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i67 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i69, %for.cond.i ]
%arrayidx.i68 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.i67
%29 = load i8, ptr %arrayidx.i68, align 8, !tbaa !17
%arrayidx2.i = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv.i67
%30 = load i8, ptr %arrayidx2.i, align 8, !tbaa !17
%cmp5.not.i = icmp eq i8 %29, %30
br i1 %cmp5.not.i, label %for.cond.i, label %if.end
if.end: ; preds = %for.body.i, %for.cond.i, %print.exit65
%str.7.sink = phi ptr [ @str.8, %print.exit65 ], [ @str.8, %for.cond.i ], [ @str.7, %for.body.i ]
%puts32 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %B) #7
call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %A) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @BubbleSort(ptr nocapture noundef %A) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.cond1.preheader.lr.ph, label %for.end20
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = zext i32 %0 to i64
%wide.trip.count = zext i32 %0 to i64
br label %for.cond1.preheader
for.cond.loopexit: ; preds = %for.inc, %for.cond1.preheader
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.cond1.preheader, !llvm.loop !11
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond.loopexit
%indvars.iv43 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next44, %for.cond.loopexit ]
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%cmp2.not.not36 = icmp ult i64 %indvars.iv.next44, %1
br i1 %cmp2.not.not36, label %for.body3, label %for.cond.loopexit
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond1.preheader ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%NUM = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next, i32 1
%2 = load i32, ptr %NUM, align 4, !tbaa !12
%3 = add nsw i64 %indvars.iv, -2
%NUM7 = getelementptr inbounds %struct.Card, ptr %A, i64 %3, i32 1
%4 = load i32, ptr %NUM7, align 4, !tbaa !12
%cmp8 = icmp slt i32 %2, %4
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.Card, ptr %A, i64 %3
%5 = load <2 x i64>, ptr %arrayidx6, align 4
%6 = shufflevector <2 x i64> %5, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %6, ptr %arrayidx6, align 4
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv.next44
br i1 %cmp2.not.not, label %for.body3, label %for.cond.loopexit, !llvm.loop !14
for.end20: ; preds = %for.cond.loopexit, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @SelectionSort(ptr nocapture noundef %B) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp36 = icmp sgt i32 %0, 0
br i1 %cmp36, label %for.cond1.preheader.preheader, label %for.end18
for.cond1.preheader.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%wide.trip.count = zext i32 %0 to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%2 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv38 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next39, %for.body3 ]
%minj.034 = phi i32 [ %2, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%NUM = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv38, i32 1
%3 = load i32, ptr %NUM, align 4, !tbaa !12
%idxprom4 = sext i32 %minj.034 to i64
%NUM6 = getelementptr inbounds %struct.Card, ptr %B, i64 %idxprom4, i32 1
%4 = load i32, ptr %NUM6, align 4, !tbaa !12
%cmp7 = icmp slt i32 %3, %4
%5 = trunc i64 %indvars.iv38 to i32
%spec.select = select i1 %cmp7, i32 %5, i32 %minj.034
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%cmp2 = icmp ult i64 %indvars.iv.next39, %1
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !15
for.end: ; preds = %for.body3
%arrayidx9 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv
%6 = load i64, ptr %arrayidx9, align 4
%idxprom12 = sext i32 %spec.select to i64
%arrayidx13 = getelementptr inbounds %struct.Card, ptr %B, i64 %idxprom12
%7 = load i64, ptr %arrayidx13, align 4
store i64 %7, ptr %arrayidx9, align 4
store i64 %6, ptr %arrayidx13, align 4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end18, label %for.cond1.preheader, !llvm.loop !16
for.end18: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr nocapture noundef readonly %A) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %0, 0
br i1 %cmp12, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%NUM.peel.phi.trans.insert = getelementptr inbounds %struct.Card, ptr %A, i64 0, i32 1
%.pre16 = load i32, ptr %NUM.peel.phi.trans.insert, align 4, !tbaa !12
%.pre = load i8, ptr %A, align 4, !tbaa !17
%conv.peel = sext i8 %.pre to i32
%call4.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv.peel, i32 noundef %.pre16)
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp.peel = icmp sgt i32 %1, 1
br i1 %cmp.peel, label %if.end, label %for.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar11 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 4, !tbaa !17
%conv = sext i8 %2 to i32
%NUM = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv, i32 1
%3 = load i32, ptr %NUM, align 4, !tbaa !12
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %conv, i32 noundef %3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr @n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %if.end, label %for.end, !llvm.loop !18
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %A, ptr nocapture noundef readonly %B) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !20
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 4, !tbaa !17
%arrayidx2 = getelementptr inbounds %struct.Card, ptr %B, i64 %indvars.iv
%2 = load i8, ptr %arrayidx2, align 4, !tbaa !17
%cmp5.not = icmp eq i8 %1, %2
br i1 %cmp5.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree norecurse nosync nounwind memory(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 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 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !6, i64 4}
!13 = !{!"Card", !7, i64 0, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!13, !7, i64 0}
!18 = distinct !{!18, !10, !19}
!19 = !{!"llvm.loop.peeled.count", i32 1}
!20 = distinct !{!20, !10}
|
#include <stdio.h>
struct card{
char pattern;
int value;
};
struct card* bubbleSort(struct card* );
struct card* selectionSort(struct card*);
int isStable(struct card* , struct card*);
int N;
int main(){
int i,j;
struct card A[36],B[36],C[36];
scanf("%d",&N);
for(i=0;i<N;i++) scanf(" %c%d",&A[i].pattern,&A[i].value);
for(i=0;i<N;i++){
B[i]=A[i];
C[i]=A[i];
}
bubbleSort(B);
for(j=0;j<N-1;j++) printf("%c%d ",B[j].pattern,B[j].value);
printf("%c%d\n",B[N-1].pattern,B[N-1].value);
if(isStable(A,B)==0) printf("Not stable\n");
else printf("Stable\n");
selectionSort(C);
for(j=0;j<N-1;j++) printf("%c%d ",C[j].pattern,C[j].value);
printf("%c%d\n",C[N-1].pattern,C[N-1].value);
if(isStable(A,C)==0) printf("Not stable\n");
else printf("Stable\n");
return 0;
}
struct card* bubbleSort(struct card *C){
int i=0,j;
struct card tmp;
for(i=0;i<N;i++){
for(j=N-1;j>=i+1;j--){
if(C[j].value < C[j-1].value){
tmp=C[j];
C[j]=C[j-1];
C[j-1]=tmp;
}
}
}
return C;
}
struct card* selectionSort(struct card *C){
int i,j,minj=0;
struct card tmp;
for(i=0;i<N;i++){
minj=i;
for(j=i+1;j<N;j++){
if(C[j].value < C[minj].value){
minj=j;
}
}
tmp=C[i];
C[i]=C[minj];
C[minj]=tmp;
}
return C;
}
int isStable(struct card *in, struct card *out){
int i,j,a,b;
for(i=0;i<N;i++){
for(j=i+1;j<N;j++){
for(a=0;a<N;a++){
for(b=a+1;b<N;b++){
if(in[i].value==in[j].value
&& in[i].pattern == out[b].pattern && in[i].value == out[b].value
&& in[j].pattern == out[a].pattern && in[j].value == out[a].value)
return 0;
}
}
}
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113879/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113879/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.card = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@N = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [36 x %struct.card], align 16
%B = alloca [36 x %struct.card], align 16
%C = alloca [36 x %struct.card], align 16
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %A) #7
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %B) #7
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %C) #7
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp168 = icmp sgt i32 %0, 0
br i1 %cmp168, label %for.body, label %bubbleSort.exit.for.end31_crit_edge
for.cond4.preheader: ; preds = %for.body
%cmp5170 = icmp sgt i32 %1, 0
br i1 %cmp5170, label %for.cond1.preheader.lr.ph.i, label %bubbleSort.exit.for.end31_crit_edge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.card], ptr %A, i64 0, i64 %indvars.iv
%value = getelementptr inbounds [36 x %struct.card], ptr %A, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %value)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond1.preheader.lr.ph.i: ; preds = %for.cond4.preheader
%3 = zext i32 %1 to i64
%4 = shl nuw nsw i64 %3, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %B, ptr nonnull align 16 %A, i64 %4, i1 false)
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %C, ptr nonnull align 16 %A, i64 %4, i1 false)
%5 = zext i32 %1 to i64
br label %for.cond1.preheader.i
for.cond.loopexit.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%exitcond.not.i = icmp eq i64 %indvars.iv.next45.i, %5
br i1 %exitcond.not.i, label %bubbleSort.exit, label %for.cond1.preheader.i, !llvm.loop !11
for.cond1.preheader.i: ; preds = %for.cond.loopexit.i, %for.cond1.preheader.lr.ph.i
%indvars.iv44.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next45.i, %for.cond.loopexit.i ]
%indvars.iv.next45.i = add nuw nsw i64 %indvars.iv44.i, 1
%cmp2.not.not37.i = icmp ult i64 %indvars.iv.next45.i, %5
br i1 %cmp2.not.not37.i, label %for.body3.i, label %for.cond.loopexit.i
for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %5, %for.cond1.preheader.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value.i = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv.next.i, i32 1
%6 = load i32, ptr %value.i, align 4, !tbaa !12
%7 = add nsw i64 %indvars.iv.i, -2
%value7.i = getelementptr inbounds %struct.card, ptr %B, i64 %7, i32 1
%8 = load i32, ptr %value7.i, align 4, !tbaa !12
%cmp8.i = icmp slt i32 %6, %8
br i1 %cmp8.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.card, ptr %B, i64 %7
%9 = load <2 x i64>, ptr %arrayidx6.i, align 8
%10 = shufflevector <2 x i64> %9, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %10, ptr %arrayidx6.i, align 8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv.next45.i
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.cond.loopexit.i, !llvm.loop !14
bubbleSort.exit: ; preds = %for.cond.loopexit.i
%cmp20173 = icmp sgt i32 %1, 1
br i1 %cmp20173, label %for.body21, label %bubbleSort.exit.for.end31_crit_edge
bubbleSort.exit.for.end31_crit_edge: ; preds = %for.cond4.preheader, %entry, %bubbleSort.exit
%11 = phi i32 [ %1, %bubbleSort.exit ], [ %1, %for.cond4.preheader ], [ %0, %entry ]
%sub172 = add nsw i32 %11, -1
%.pre = sext i32 %sub172 to i64
br label %for.end31
for.body21: ; preds = %bubbleSort.exit, %for.body21
%indvars.iv187 = phi i64 [ %indvars.iv.next188, %for.body21 ], [ 0, %bubbleSort.exit ]
%arrayidx23 = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv187
%12 = load i8, ptr %arrayidx23, align 8, !tbaa !15
%conv = sext i8 %12 to i32
%value27 = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv187, i32 1
%13 = load i32, ptr %value27, align 4, !tbaa !12
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %13)
%indvars.iv.next188 = add nuw nsw i64 %indvars.iv187, 1
%14 = load i32, ptr @N, align 4, !tbaa !5
%sub = add nsw i32 %14, -1
%15 = sext i32 %sub to i64
%cmp20 = icmp slt i64 %indvars.iv.next188, %15
br i1 %cmp20, label %for.body21, label %for.end31, !llvm.loop !16
for.end31: ; preds = %for.body21, %bubbleSort.exit.for.end31_crit_edge
%idxprom33.pre-phi = phi i64 [ %.pre, %bubbleSort.exit.for.end31_crit_edge ], [ %15, %for.body21 ]
%arrayidx34 = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %idxprom33.pre-phi
%16 = load i8, ptr %arrayidx34, align 8, !tbaa !15
%conv36 = sext i8 %16 to i32
%value40 = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %idxprom33.pre-phi, i32 1
%17 = load i32, ptr %value40, align 4, !tbaa !12
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv36, i32 noundef %17)
%18 = load i32, ptr @N, align 4, !tbaa !5
%cmp102.i = icmp sgt i32 %18, 0
br i1 %cmp102.i, label %for.body.us.preheader.i, label %if.end
for.body.us.preheader.i: ; preds = %for.end31
%19 = zext i32 %18 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv122.i = phi i64 [ 0, %for.body.us.preheader.i ], [ %indvars.iv.next123.i, %for.cond.loopexit.us.i ]
%indvars.iv115.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next116.i, %for.cond.loopexit.us.i ]
%indvars.iv.next123.i = add nuw nsw i64 %indvars.iv122.i, 1
%cmp294.us.i = icmp ult i64 %indvars.iv.next123.i, %19
br i1 %cmp294.us.i, label %for.cond4.preheader.lr.ph.us.i, label %for.cond.loopexit.us.i
for.cond.loopexit.us.i: ; preds = %for.cond4.for.inc55_crit_edge.us.us.i, %for.body.us.i
%indvars.iv.next116.i = add nuw nsw i64 %indvars.iv115.i, 1
%exitcond126.not.i = icmp eq i64 %indvars.iv.next123.i, %19
br i1 %exitcond126.not.i, label %if.end, label %for.body.us.i, !llvm.loop !17
for.cond4.preheader.lr.ph.us.i: ; preds = %for.body.us.i
%value.us.i = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv122.i, i32 1
%arrayidx.us.i = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv122.i
br label %for.cond4.preheader.us.us.i
for.cond4.preheader.us.us.i: ; preds = %for.cond4.for.inc55_crit_edge.us.us.i, %for.cond4.preheader.lr.ph.us.i
%indvars.iv117.i = phi i64 [ %indvars.iv.next118.i, %for.cond4.for.inc55_crit_edge.us.us.i ], [ %indvars.iv115.i, %for.cond4.preheader.lr.ph.us.i ]
%arrayidx12.us.us.i = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv117.i
%value13.us.us.i = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv117.i, i32 1
br label %for.body6.us.us.i
for.body6.us.us.i: ; preds = %for.cond4.loopexit.us.us.i, %for.cond4.preheader.us.us.i
%indvars.iv110.i = phi i64 [ %indvars.iv.next111.i, %for.cond4.loopexit.us.us.i ], [ 0, %for.cond4.preheader.us.us.i ]
%indvars.iv.i106 = phi i64 [ %indvars.iv.next.i107, %for.cond4.loopexit.us.us.i ], [ 1, %for.cond4.preheader.us.us.i ]
%indvars.iv.next111.i = add nuw nsw i64 %indvars.iv110.i, 1
%cmp990.us.us.i = icmp ult i64 %indvars.iv.next111.i, %19
br i1 %cmp990.us.us.i, label %for.body10.lr.ph.us.us.i, label %for.cond4.loopexit.us.us.i
for.cond4.loopexit.us.us.i: ; preds = %for.inc.us.us.us.i, %for.body10.lr.ph.us.us.i, %for.body6.us.us.i
%indvars.iv.next.i107 = add nuw nsw i64 %indvars.iv.i106, 1
%exitcond114.not.i = icmp eq i64 %indvars.iv.next111.i, %19
br i1 %exitcond114.not.i, label %for.cond4.for.inc55_crit_edge.us.us.i, label %for.body6.us.us.i, !llvm.loop !18
for.body10.lr.ph.us.us.i: ; preds = %for.body6.us.us.i
%20 = load i32, ptr %value.us.i, align 4, !tbaa !12
%21 = load i32, ptr %value13.us.us.i, align 4, !tbaa !12
%cmp14.us.us.i = icmp eq i32 %20, %21
%arrayidx38.us.us.i = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv110.i
%value49.us.us.i = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv110.i, i32 1
br i1 %cmp14.us.us.i, label %for.body10.lr.ph.split.us.us.us.i, label %for.cond4.loopexit.us.us.i
for.body10.lr.ph.split.us.us.us.i: ; preds = %for.body10.lr.ph.us.us.i
%22 = load i8, ptr %arrayidx.us.i, align 8, !tbaa !15
br label %for.body10.us.us.us.i
for.body10.us.us.us.i: ; preds = %for.inc.us.us.us.i, %for.body10.lr.ph.split.us.us.us.i
%indvars.iv107.i = phi i64 [ %indvars.iv.next108.i, %for.inc.us.us.us.i ], [ %indvars.iv.i106, %for.body10.lr.ph.split.us.us.us.i ]
%arrayidx18.us.us.us.i = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv107.i
%23 = load i8, ptr %arrayidx18.us.us.us.i, align 8, !tbaa !15
%cmp21.us.us.us.i = icmp eq i8 %22, %23
br i1 %cmp21.us.us.us.i, label %land.lhs.true23.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true23.us.us.us.i: ; preds = %for.body10.us.us.us.i
%value29.us.us.us.i = getelementptr inbounds %struct.card, ptr %B, i64 %indvars.iv107.i, i32 1
%24 = load i32, ptr %value29.us.us.us.i, align 4, !tbaa !12
%cmp30.us.us.us.i = icmp eq i32 %20, %24
br i1 %cmp30.us.us.us.i, label %land.lhs.true32.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true32.us.us.us.i: ; preds = %land.lhs.true23.us.us.us.i
%25 = load i8, ptr %arrayidx12.us.us.i, align 8, !tbaa !15
%26 = load i8, ptr %arrayidx38.us.us.i, align 8, !tbaa !15
%cmp41.us.us.us.i = icmp eq i8 %25, %26
br i1 %cmp41.us.us.us.i, label %land.lhs.true43.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true43.us.us.us.i: ; preds = %land.lhs.true32.us.us.us.i
%27 = load i32, ptr %value49.us.us.i, align 4, !tbaa !12
%cmp50.us.us.us.i = icmp eq i32 %20, %27
br i1 %cmp50.us.us.us.i, label %if.end, label %for.inc.us.us.us.i
for.inc.us.us.us.i: ; preds = %land.lhs.true43.us.us.us.i, %land.lhs.true32.us.us.us.i, %land.lhs.true23.us.us.us.i, %for.body10.us.us.us.i
%indvars.iv.next108.i = add nuw nsw i64 %indvars.iv107.i, 1
%exitcond.not.i108 = icmp eq i64 %indvars.iv.next108.i, %19
br i1 %exitcond.not.i108, label %for.cond4.loopexit.us.us.i, label %for.body10.us.us.us.i, !llvm.loop !19
for.cond4.for.inc55_crit_edge.us.us.i: ; preds = %for.cond4.loopexit.us.us.i
%indvars.iv.next118.i = add nuw nsw i64 %indvars.iv117.i, 1
%exitcond121.not.i = icmp eq i64 %indvars.iv.next118.i, %19
br i1 %exitcond121.not.i, label %for.cond.loopexit.us.i, label %for.cond4.preheader.us.us.i, !llvm.loop !20
if.end: ; preds = %for.cond.loopexit.us.i, %land.lhs.true43.us.us.us.i, %for.end31
%str.sink = phi ptr [ @str.7, %for.end31 ], [ @str.8, %land.lhs.true43.us.us.us.i ], [ @str.7, %for.cond.loopexit.us.i ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%28 = load i32, ptr @N, align 4, !tbaa !5
%cmp38.i = icmp sgt i32 %28, 0
br i1 %cmp38.i, label %for.body.preheader.i, label %selectionSort.exit.for.end66_crit_edge
for.body.preheader.i: ; preds = %if.end
%29 = zext i32 %28 to i64
br label %for.body.i
for.body.i: ; preds = %for.end.i, %for.body.preheader.i
%indvars.iv43.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next44.i, %for.end.i ]
%indvars.iv.i109 = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i110, %for.end.i ]
%indvars.iv.next44.i = add nuw nsw i64 %indvars.iv43.i, 1
%cmp235.i = icmp ult i64 %indvars.iv.next44.i, %29
%30 = trunc i64 %indvars.iv43.i to i32
br i1 %cmp235.i, label %for.body3.i111, label %for.end.i
for.body3.i111: ; preds = %for.body.i, %for.body3.i111
%indvars.iv40.i = phi i64 [ %indvars.iv.next41.i, %for.body3.i111 ], [ %indvars.iv.i109, %for.body.i ]
%minj.037.i = phi i32 [ %spec.select.i, %for.body3.i111 ], [ %30, %for.body.i ]
%value.i112 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv40.i, i32 1
%31 = load i32, ptr %value.i112, align 4, !tbaa !12
%idxprom4.i = sext i32 %minj.037.i to i64
%value6.i = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom4.i, i32 1
%32 = load i32, ptr %value6.i, align 4, !tbaa !12
%cmp7.i = icmp slt i32 %31, %32
%33 = trunc i64 %indvars.iv40.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %33, i32 %minj.037.i
%indvars.iv.next41.i = add nuw nsw i64 %indvars.iv40.i, 1
%exitcond.not.i113 = icmp eq i64 %indvars.iv.next41.i, %29
br i1 %exitcond.not.i113, label %for.end.i, label %for.body3.i111, !llvm.loop !21
for.end.i: ; preds = %for.body3.i111, %for.body.i
%minj.0.lcssa.i = phi i32 [ %30, %for.body.i ], [ %spec.select.i, %for.body3.i111 ]
%arrayidx9.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv43.i
%34 = load i64, ptr %arrayidx9.i, align 8
%idxprom12.i = sext i32 %minj.0.lcssa.i to i64
%arrayidx13.i = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom12.i
%35 = load i64, ptr %arrayidx13.i, align 8
store i64 %35, ptr %arrayidx9.i, align 8
store i64 %34, ptr %arrayidx13.i, align 8
%indvars.iv.next.i110 = add nuw nsw i64 %indvars.iv.i109, 1
%exitcond47.not.i = icmp eq i64 %indvars.iv.next44.i, %29
br i1 %exitcond47.not.i, label %selectionSort.exit, label %for.body.i, !llvm.loop !22
selectionSort.exit: ; preds = %for.end.i
%cmp53177 = icmp sgt i32 %28, 1
br i1 %cmp53177, label %for.body55, label %selectionSort.exit.for.end66_crit_edge
selectionSort.exit.for.end66_crit_edge: ; preds = %if.end, %selectionSort.exit
%sub52176 = add nsw i32 %28, -1
%.pre193 = sext i32 %sub52176 to i64
br label %for.end66
for.body55: ; preds = %selectionSort.exit, %for.body55
%indvars.iv190 = phi i64 [ %indvars.iv.next191, %for.body55 ], [ 0, %selectionSort.exit ]
%arrayidx57 = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %indvars.iv190
%36 = load i8, ptr %arrayidx57, align 8, !tbaa !15
%conv59 = sext i8 %36 to i32
%value62 = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %indvars.iv190, i32 1
%37 = load i32, ptr %value62, align 4, !tbaa !12
%call63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv59, i32 noundef %37)
%indvars.iv.next191 = add nuw nsw i64 %indvars.iv190, 1
%38 = load i32, ptr @N, align 4, !tbaa !5
%sub52 = add nsw i32 %38, -1
%39 = sext i32 %sub52 to i64
%cmp53 = icmp slt i64 %indvars.iv.next191, %39
br i1 %cmp53, label %for.body55, label %for.end66, !llvm.loop !23
for.end66: ; preds = %for.body55, %selectionSort.exit.for.end66_crit_edge
%idxprom68.pre-phi = phi i64 [ %.pre193, %selectionSort.exit.for.end66_crit_edge ], [ %39, %for.body55 ]
%arrayidx69 = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %idxprom68.pre-phi
%40 = load i8, ptr %arrayidx69, align 8, !tbaa !15
%conv71 = sext i8 %40 to i32
%value75 = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %idxprom68.pre-phi, i32 1
%41 = load i32, ptr %value75, align 4, !tbaa !12
%call76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv71, i32 noundef %41)
%42 = load i32, ptr @N, align 4, !tbaa !5
%cmp102.i114 = icmp sgt i32 %42, 0
br i1 %cmp102.i114, label %for.body.us.preheader.i116, label %if.end86
for.body.us.preheader.i116: ; preds = %for.end66
%43 = zext i32 %42 to i64
br label %for.body.us.i118
for.body.us.i118: ; preds = %for.cond.loopexit.us.i123, %for.body.us.preheader.i116
%indvars.iv122.i119 = phi i64 [ 0, %for.body.us.preheader.i116 ], [ %indvars.iv.next123.i121, %for.cond.loopexit.us.i123 ]
%indvars.iv115.i120 = phi i64 [ 1, %for.body.us.preheader.i116 ], [ %indvars.iv.next116.i124, %for.cond.loopexit.us.i123 ]
%indvars.iv.next123.i121 = add nuw nsw i64 %indvars.iv122.i119, 1
%cmp294.us.i122 = icmp ult i64 %indvars.iv.next123.i121, %43
br i1 %cmp294.us.i122, label %for.cond4.preheader.lr.ph.us.i126, label %for.cond.loopexit.us.i123
for.cond.loopexit.us.i123: ; preds = %for.cond4.for.inc55_crit_edge.us.us.i141, %for.body.us.i118
%indvars.iv.next116.i124 = add nuw nsw i64 %indvars.iv115.i120, 1
%exitcond126.not.i125 = icmp eq i64 %indvars.iv.next123.i121, %43
br i1 %exitcond126.not.i125, label %if.end86, label %for.body.us.i118, !llvm.loop !17
for.cond4.preheader.lr.ph.us.i126: ; preds = %for.body.us.i118
%value.us.i127 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv122.i119, i32 1
%arrayidx.us.i128 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv122.i119
br label %for.cond4.preheader.us.us.i129
for.cond4.preheader.us.us.i129: ; preds = %for.cond4.for.inc55_crit_edge.us.us.i141, %for.cond4.preheader.lr.ph.us.i126
%indvars.iv117.i130 = phi i64 [ %indvars.iv.next118.i142, %for.cond4.for.inc55_crit_edge.us.us.i141 ], [ %indvars.iv115.i120, %for.cond4.preheader.lr.ph.us.i126 ]
%arrayidx12.us.us.i131 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv117.i130
%value13.us.us.i132 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv117.i130, i32 1
br label %for.body6.us.us.i133
for.body6.us.us.i133: ; preds = %for.cond4.loopexit.us.us.i138, %for.cond4.preheader.us.us.i129
%indvars.iv110.i134 = phi i64 [ %indvars.iv.next111.i136, %for.cond4.loopexit.us.us.i138 ], [ 0, %for.cond4.preheader.us.us.i129 ]
%indvars.iv.i135 = phi i64 [ %indvars.iv.next.i139, %for.cond4.loopexit.us.us.i138 ], [ 1, %for.cond4.preheader.us.us.i129 ]
%indvars.iv.next111.i136 = add nuw nsw i64 %indvars.iv110.i134, 1
%cmp990.us.us.i137 = icmp ult i64 %indvars.iv.next111.i136, %43
br i1 %cmp990.us.us.i137, label %for.body10.lr.ph.us.us.i144, label %for.cond4.loopexit.us.us.i138
for.cond4.loopexit.us.us.i138: ; preds = %for.inc.us.us.us.i153, %for.body10.lr.ph.us.us.i144, %for.body6.us.us.i133
%indvars.iv.next.i139 = add nuw nsw i64 %indvars.iv.i135, 1
%exitcond114.not.i140 = icmp eq i64 %indvars.iv.next111.i136, %43
br i1 %exitcond114.not.i140, label %for.cond4.for.inc55_crit_edge.us.us.i141, label %for.body6.us.us.i133, !llvm.loop !18
for.body10.lr.ph.us.us.i144: ; preds = %for.body6.us.us.i133
%44 = load i32, ptr %value.us.i127, align 4, !tbaa !12
%45 = load i32, ptr %value13.us.us.i132, align 4, !tbaa !12
%cmp14.us.us.i145 = icmp eq i32 %44, %45
%arrayidx38.us.us.i146 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv110.i134
%value49.us.us.i147 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv110.i134, i32 1
br i1 %cmp14.us.us.i145, label %for.body10.lr.ph.split.us.us.us.i148, label %for.cond4.loopexit.us.us.i138
for.body10.lr.ph.split.us.us.us.i148: ; preds = %for.body10.lr.ph.us.us.i144
%46 = load i8, ptr %arrayidx.us.i128, align 8, !tbaa !15
br label %for.body10.us.us.us.i149
for.body10.us.us.us.i149: ; preds = %for.inc.us.us.us.i153, %for.body10.lr.ph.split.us.us.us.i148
%indvars.iv107.i150 = phi i64 [ %indvars.iv.next108.i154, %for.inc.us.us.us.i153 ], [ %indvars.iv.i135, %for.body10.lr.ph.split.us.us.us.i148 ]
%arrayidx18.us.us.us.i151 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv107.i150
%47 = load i8, ptr %arrayidx18.us.us.us.i151, align 8, !tbaa !15
%cmp21.us.us.us.i152 = icmp eq i8 %46, %47
br i1 %cmp21.us.us.us.i152, label %land.lhs.true23.us.us.us.i156, label %for.inc.us.us.us.i153
land.lhs.true23.us.us.us.i156: ; preds = %for.body10.us.us.us.i149
%value29.us.us.us.i157 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv107.i150, i32 1
%48 = load i32, ptr %value29.us.us.us.i157, align 4, !tbaa !12
%cmp30.us.us.us.i158 = icmp eq i32 %44, %48
br i1 %cmp30.us.us.us.i158, label %land.lhs.true32.us.us.us.i159, label %for.inc.us.us.us.i153
land.lhs.true32.us.us.us.i159: ; preds = %land.lhs.true23.us.us.us.i156
%49 = load i8, ptr %arrayidx12.us.us.i131, align 8, !tbaa !15
%50 = load i8, ptr %arrayidx38.us.us.i146, align 8, !tbaa !15
%cmp41.us.us.us.i160 = icmp eq i8 %49, %50
br i1 %cmp41.us.us.us.i160, label %land.lhs.true43.us.us.us.i161, label %for.inc.us.us.us.i153
land.lhs.true43.us.us.us.i161: ; preds = %land.lhs.true32.us.us.us.i159
%51 = load i32, ptr %value49.us.us.i147, align 4, !tbaa !12
%cmp50.us.us.us.i162 = icmp eq i32 %44, %51
br i1 %cmp50.us.us.us.i162, label %if.end86, label %for.inc.us.us.us.i153
for.inc.us.us.us.i153: ; preds = %land.lhs.true43.us.us.us.i161, %land.lhs.true32.us.us.us.i159, %land.lhs.true23.us.us.us.i156, %for.body10.us.us.us.i149
%indvars.iv.next108.i154 = add nuw nsw i64 %indvars.iv107.i150, 1
%exitcond.not.i155 = icmp eq i64 %indvars.iv.next108.i154, %43
br i1 %exitcond.not.i155, label %for.cond4.loopexit.us.us.i138, label %for.body10.us.us.us.i149, !llvm.loop !19
for.cond4.for.inc55_crit_edge.us.us.i141: ; preds = %for.cond4.loopexit.us.us.i138
%indvars.iv.next118.i142 = add nuw nsw i64 %indvars.iv117.i130, 1
%exitcond121.not.i143 = icmp eq i64 %indvars.iv.next118.i142, %43
br i1 %exitcond121.not.i143, label %for.cond.loopexit.us.i123, label %for.cond4.preheader.us.us.i129, !llvm.loop !20
if.end86: ; preds = %for.cond.loopexit.us.i123, %land.lhs.true43.us.us.us.i161, %for.end66
%str.7.sink = phi ptr [ @str.7, %for.end66 ], [ @str.8, %land.lhs.true43.us.us.us.i161 ], [ @str.7, %for.cond.loopexit.us.i123 ]
%puts104 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %C) #7
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %B) #7
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %A) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local ptr @bubbleSort(ptr noundef returned %C) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.cond1.preheader.lr.ph, label %for.end20
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = zext i32 %0 to i64
%wide.trip.count = zext i32 %0 to i64
br label %for.cond1.preheader
for.cond.loopexit: ; preds = %for.inc, %for.cond1.preheader
%exitcond.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.cond1.preheader, !llvm.loop !11
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond.loopexit
%indvars.iv44 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next45, %for.cond.loopexit ]
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%cmp2.not.not37 = icmp ult i64 %indvars.iv.next45, %1
br i1 %cmp2.not.not37, label %for.body3, label %for.cond.loopexit
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond1.preheader ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv.next, i32 1
%2 = load i32, ptr %value, align 4, !tbaa !12
%3 = add nsw i64 %indvars.iv, -2
%value7 = getelementptr inbounds %struct.card, ptr %C, i64 %3, i32 1
%4 = load i32, ptr %value7, align 4, !tbaa !12
%cmp8 = icmp slt i32 %2, %4
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.card, ptr %C, i64 %3
%5 = load <2 x i64>, ptr %arrayidx6, align 4
%6 = shufflevector <2 x i64> %5, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %6, ptr %arrayidx6, align 4
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv.next45
br i1 %cmp2.not.not, label %for.body3, label %for.cond.loopexit, !llvm.loop !14
for.end20: ; preds = %for.cond.loopexit, %entry
ret ptr %C
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %in, ptr nocapture noundef readonly %out) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp102 = icmp sgt i32 %0, 0
br i1 %cmp102, label %for.body.us.preheader, label %cleanup
for.body.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%wide.trip.count125 = zext i32 %0 to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond.loopexit.us
%indvars.iv122 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next123, %for.cond.loopexit.us ]
%indvars.iv115 = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next116, %for.cond.loopexit.us ]
%indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
%cmp294.us = icmp ult i64 %indvars.iv.next123, %1
br i1 %cmp294.us, label %for.cond4.preheader.lr.ph.us, label %for.cond.loopexit.us
for.cond.loopexit.us: ; preds = %for.cond4.for.inc55_crit_edge.us.us, %for.body.us
%indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
%exitcond126.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count125
br i1 %exitcond126.not, label %cleanup, label %for.body.us, !llvm.loop !17
for.cond4.preheader.lr.ph.us: ; preds = %for.body.us
%value.us = getelementptr inbounds %struct.card, ptr %in, i64 %indvars.iv122, i32 1
%arrayidx.us = getelementptr inbounds %struct.card, ptr %in, i64 %indvars.iv122
br label %for.cond4.preheader.us.us
for.cond4.preheader.us.us: ; preds = %for.cond4.for.inc55_crit_edge.us.us, %for.cond4.preheader.lr.ph.us
%indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.cond4.for.inc55_crit_edge.us.us ], [ %indvars.iv115, %for.cond4.preheader.lr.ph.us ]
%arrayidx12.us.us = getelementptr inbounds %struct.card, ptr %in, i64 %indvars.iv117
%value13.us.us = getelementptr inbounds %struct.card, ptr %in, i64 %indvars.iv117, i32 1
br label %for.body6.us.us
for.body6.us.us: ; preds = %for.cond4.loopexit.us.us, %for.cond4.preheader.us.us
%indvars.iv110 = phi i64 [ %indvars.iv.next111, %for.cond4.loopexit.us.us ], [ 0, %for.cond4.preheader.us.us ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond4.loopexit.us.us ], [ 1, %for.cond4.preheader.us.us ]
%indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
%cmp990.us.us = icmp ult i64 %indvars.iv.next111, %1
br i1 %cmp990.us.us, label %for.body10.lr.ph.us.us, label %for.cond4.loopexit.us.us
for.cond4.loopexit.us.us: ; preds = %for.inc.us.us.us, %for.body10.lr.ph.us.us, %for.body6.us.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond114.not = icmp eq i64 %indvars.iv.next111, %wide.trip.count125
br i1 %exitcond114.not, label %for.cond4.for.inc55_crit_edge.us.us, label %for.body6.us.us, !llvm.loop !18
for.body10.lr.ph.us.us: ; preds = %for.body6.us.us
%2 = load i32, ptr %value.us, align 4, !tbaa !12
%3 = load i32, ptr %value13.us.us, align 4, !tbaa !12
%cmp14.us.us = icmp eq i32 %2, %3
%arrayidx38.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv110
%value49.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv110, i32 1
br i1 %cmp14.us.us, label %for.body10.lr.ph.split.us.us.us, label %for.cond4.loopexit.us.us
for.body10.lr.ph.split.us.us.us: ; preds = %for.body10.lr.ph.us.us
%4 = load i8, ptr %arrayidx.us, align 4, !tbaa !15
br label %for.body10.us.us.us
for.body10.us.us.us: ; preds = %for.inc.us.us.us, %for.body10.lr.ph.split.us.us.us
%indvars.iv107 = phi i64 [ %indvars.iv.next108, %for.inc.us.us.us ], [ %indvars.iv, %for.body10.lr.ph.split.us.us.us ]
%arrayidx18.us.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv107
%5 = load i8, ptr %arrayidx18.us.us.us, align 4, !tbaa !15
%cmp21.us.us.us = icmp eq i8 %4, %5
br i1 %cmp21.us.us.us, label %land.lhs.true23.us.us.us, label %for.inc.us.us.us
land.lhs.true23.us.us.us: ; preds = %for.body10.us.us.us
%value29.us.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv107, i32 1
%6 = load i32, ptr %value29.us.us.us, align 4, !tbaa !12
%cmp30.us.us.us = icmp eq i32 %2, %6
br i1 %cmp30.us.us.us, label %land.lhs.true32.us.us.us, label %for.inc.us.us.us
land.lhs.true32.us.us.us: ; preds = %land.lhs.true23.us.us.us
%7 = load i8, ptr %arrayidx12.us.us, align 4, !tbaa !15
%8 = load i8, ptr %arrayidx38.us.us, align 4, !tbaa !15
%cmp41.us.us.us = icmp eq i8 %7, %8
br i1 %cmp41.us.us.us, label %land.lhs.true43.us.us.us, label %for.inc.us.us.us
land.lhs.true43.us.us.us: ; preds = %land.lhs.true32.us.us.us
%9 = load i32, ptr %value49.us.us, align 4, !tbaa !12
%cmp50.us.us.us = icmp eq i32 %2, %9
br i1 %cmp50.us.us.us, label %cleanup, label %for.inc.us.us.us
for.inc.us.us.us: ; preds = %land.lhs.true43.us.us.us, %land.lhs.true32.us.us.us, %land.lhs.true23.us.us.us, %for.body10.us.us.us
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%exitcond.not = icmp eq i64 %indvars.iv.next108, %wide.trip.count125
br i1 %exitcond.not, label %for.cond4.loopexit.us.us, label %for.body10.us.us.us, !llvm.loop !19
for.cond4.for.inc55_crit_edge.us.us: ; preds = %for.cond4.loopexit.us.us
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%exitcond121.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count125
br i1 %exitcond121.not, label %for.cond.loopexit.us, label %for.cond4.preheader.us.us, !llvm.loop !20
cleanup: ; preds = %for.cond.loopexit.us, %land.lhs.true43.us.us.us, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %land.lhs.true43.us.us.us ], [ 1, %for.cond.loopexit.us ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local ptr @selectionSort(ptr noundef returned %C) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp38 = icmp sgt i32 %0, 0
br i1 %cmp38, label %for.body.preheader, label %for.end18
for.body.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%wide.trip.count46 = zext i32 %0 to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.end
%indvars.iv43 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next44, %for.end ]
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.end ]
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%cmp235 = icmp ult i64 %indvars.iv.next44, %1
%2 = trunc i64 %indvars.iv43 to i32
br i1 %cmp235, label %for.body3, label %for.end
for.body3: ; preds = %for.body, %for.body3
%indvars.iv40 = phi i64 [ %indvars.iv.next41, %for.body3 ], [ %indvars.iv, %for.body ]
%minj.037 = phi i32 [ %spec.select, %for.body3 ], [ %2, %for.body ]
%value = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv40, i32 1
%3 = load i32, ptr %value, align 4, !tbaa !12
%idxprom4 = sext i32 %minj.037 to i64
%value6 = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom4, i32 1
%4 = load i32, ptr %value6, align 4, !tbaa !12
%cmp7 = icmp slt i32 %3, %4
%5 = trunc i64 %indvars.iv40 to i32
%spec.select = select i1 %cmp7, i32 %5, i32 %minj.037
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%exitcond.not = icmp eq i64 %indvars.iv.next41, %wide.trip.count46
br i1 %exitcond.not, label %for.end, label %for.body3, !llvm.loop !21
for.end: ; preds = %for.body3, %for.body
%minj.0.lcssa = phi i32 [ %2, %for.body ], [ %spec.select, %for.body3 ]
%arrayidx9 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv43
%6 = load i64, ptr %arrayidx9, align 4
%idxprom12 = sext i32 %minj.0.lcssa to i64
%arrayidx13 = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom12
%7 = load i64, ptr %arrayidx13, align 4
store i64 %7, ptr %arrayidx9, align 4
store i64 %6, ptr %arrayidx13, align 4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond47.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count46
br i1 %exitcond47.not, label %for.end18, label %for.body, !llvm.loop !22
for.end18: ; preds = %for.end, %entry
ret ptr %C
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree norecurse nosync nounwind memory(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 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 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !6, i64 4}
!13 = !{!"card", !7, i64 0, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = !{!13, !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
|
#include<stdio.h>
typedef struct{
char suit;
int num;
}CARD;
int main(){
int i,j,a,b,n,minj,flag=1;
CARD A[36],B[36],temp;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf(" %c%d",&A[i].suit,&A[i].num);
B[i].suit=A[i].suit;
B[i].num=A[i].num;
}
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(A[j].num < A[j-1].num){
temp.suit=A[j].suit;
temp.num=A[j].num;
A[j].suit=A[j-1].suit;
A[j].num=A[j-1].num;
A[j-1].suit=temp.suit;
A[j-1].num=temp.num;
}
}
}
for(i=0;i<n;i++){
minj=i;
for(j=i;j<n;j++){
if(B[j].num < B[minj].num){
minj=j;
}
}
temp.suit=B[i].suit;
temp.num=B[i].num;
B[i].suit=B[minj].suit;
B[i].num=B[minj].num;
B[minj].suit=temp.suit;
B[minj].num=temp.num;
}
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
for(a=0;a<n;a++){
for(b=a+1;b<n;b++){
if((A[i].num==A[j].num)&&(A[i].suit==B[b].suit)&&(A[i].num==B[b].num)&&(A[j].suit==B[a].suit)&&(A[j].num==B[a].num)){
flag=0;
}
}
}
}
}
for(i=0;i<n-1;i++){
printf("%c%d ",A[i].suit,A[i].num);
}
printf("%c%d\n",A[n-1].suit,A[n-1].num);
printf("Stable\n");
for(i=0;i<n-1;i++){
printf("%c%d ",B[i].suit,B[i].num);
}
printf("%c%d\n",B[n-1].suit,B[n-1].num);
if(flag==1){
printf("Stable\n");
}
else printf("Not stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113921/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113921/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.CARD = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.6 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%A = alloca [36 x %struct.CARD], align 16
%B = alloca [36 x %struct.CARD], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp319 = icmp sgt i32 %0, 0
br i1 %cmp319, label %for.body, label %for.cond188.preheader.for.end203_crit_edge
for.cond16.preheader: ; preds = %for.body
%cmp17325 = icmp sgt i32 %6, 0
br i1 %cmp17325, label %for.cond19.preheader.lr.ph, label %for.cond188.preheader.for.end203_crit_edge
for.cond19.preheader.lr.ph: ; preds = %for.cond16.preheader
%j.0321 = add nsw i32 %6, -1
%1 = zext i32 %6 to i64
%2 = add nsw i64 %1, -1
%3 = zext i32 %j.0321 to i64
%wide.trip.count = zext i32 %6 to i64
br label %for.cond19.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %indvars.iv
%num = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %num)
%4 = load i8, ptr %arrayidx, align 8, !tbaa !9
%arrayidx8 = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %indvars.iv
store i8 %4, ptr %arrayidx8, align 8, !tbaa !9
%5 = load i32, ptr %num, align 4, !tbaa !11
%num15 = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %indvars.iv, i32 1
store i32 %5, ptr %num15, align 4, !tbaa !11
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond16.preheader, !llvm.loop !12
for.cond19.preheader: ; preds = %for.cond19.preheader.lr.ph, %for.inc64
%indvars.iv376 = phi i64 [ 0, %for.cond19.preheader.lr.ph ], [ %indvars.iv.next377, %for.inc64 ]
%cmp20322 = icmp ult i64 %indvars.iv376, %3
br i1 %cmp20322, label %for.body21, label %for.inc64
for.cond67.preheader: ; preds = %for.inc64
br i1 %cmp17325, label %for.cond70.preheader.preheader, label %for.cond188.preheader
for.cond70.preheader.preheader: ; preds = %for.cond67.preheader
%8 = zext i32 %6 to i64
%wide.trip.count385 = zext i32 %6 to i64
br label %for.cond70.preheader
for.body21: ; preds = %for.cond19.preheader, %for.inc62
%indvars.iv370 = phi i64 [ %indvars.iv.next371, %for.inc62 ], [ %1, %for.cond19.preheader ]
%indvars.iv368 = phi i64 [ %indvars.iv.next369, %for.inc62 ], [ %2, %for.cond19.preheader ]
%indvars.iv.next371 = add nsw i64 %indvars.iv370, -1
%num24 = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %indvars.iv368, i32 1
%9 = load i32, ptr %num24, align 4, !tbaa !11
%10 = add nsw i64 %indvars.iv370, -2
%num28 = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %10, i32 1
%11 = load i32, ptr %num28, align 4, !tbaa !11
%cmp29 = icmp slt i32 %9, %11
br i1 %cmp29, label %if.then, label %for.inc62
if.then: ; preds = %for.body21
%arrayidx27 = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %10
%arrayidx23 = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %indvars.iv368
%12 = load i8, ptr %arrayidx23, align 8, !tbaa !9
%13 = load i8, ptr %arrayidx27, align 8, !tbaa !9
store i8 %13, ptr %arrayidx23, align 8, !tbaa !9
store i32 %11, ptr %num24, align 4, !tbaa !11
store i8 %12, ptr %arrayidx27, align 8, !tbaa !9
store i32 %9, ptr %num28, align 4, !tbaa !11
br label %for.inc62
for.inc62: ; preds = %for.body21, %if.then
%indvars.iv.next369 = add nsw i64 %indvars.iv368, -1
%cmp20 = icmp sgt i64 %indvars.iv.next369, %indvars.iv376
br i1 %cmp20, label %for.body21, label %for.inc64, !llvm.loop !14
for.inc64: ; preds = %for.inc62, %for.cond19.preheader
%indvars.iv.next377 = add nuw nsw i64 %indvars.iv376, 1
%exitcond.not = icmp eq i64 %indvars.iv.next377, %wide.trip.count
br i1 %exitcond.not, label %for.cond67.preheader, label %for.cond19.preheader, !llvm.loop !15
for.cond70.preheader: ; preds = %for.cond70.preheader.preheader, %for.end84
%indvars.iv379 = phi i64 [ 0, %for.cond70.preheader.preheader ], [ %indvars.iv.next380, %for.end84 ]
%14 = trunc i64 %indvars.iv379 to i32
br label %for.body72
for.cond116.preheader: ; preds = %for.end84
br i1 %cmp17325, label %for.body118.us.preheader, label %for.cond188.preheader
for.body118.us.preheader: ; preds = %for.cond116.preheader
%15 = zext i32 %6 to i64
%wide.trip.count409 = zext i32 %6 to i64
br label %for.body118.us
for.body118.us: ; preds = %for.body118.us.preheader, %for.cond116.loopexit.us
%indvars.iv406 = phi i64 [ 0, %for.body118.us.preheader ], [ %indvars.iv.next407, %for.cond116.loopexit.us ]
%indvars.iv399 = phi i64 [ 1, %for.body118.us.preheader ], [ %indvars.iv.next400, %for.cond116.loopexit.us ]
%flag.0351.us = phi i32 [ 1, %for.body118.us.preheader ], [ %flag.1.lcssa.us, %for.cond116.loopexit.us ]
%indvars.iv.next407 = add nuw nsw i64 %indvars.iv406, 1
%cmp120339.us = icmp ult i64 %indvars.iv.next407, %15
br i1 %cmp120339.us, label %for.cond122.preheader.lr.ph.us, label %for.cond116.loopexit.us
for.cond116.loopexit.us: ; preds = %for.cond122.for.inc182_crit_edge.us.us, %for.body118.us
%flag.1.lcssa.us = phi i32 [ %flag.0351.us, %for.body118.us ], [ %flag.3.lcssa.us.us, %for.cond122.for.inc182_crit_edge.us.us ]
%indvars.iv.next400 = add nuw nsw i64 %indvars.iv399, 1
%exitcond410.not = icmp eq i64 %indvars.iv.next407, %wide.trip.count409
br i1 %exitcond410.not, label %for.cond188.preheader.loopexit, label %for.body118.us, !llvm.loop !16
for.cond122.preheader.lr.ph.us: ; preds = %for.body118.us
%num131.us = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %indvars.iv406, i32 1
%arrayidx130.us = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %indvars.iv406
br label %for.cond122.preheader.us.us
for.cond122.preheader.us.us: ; preds = %for.cond122.for.inc182_crit_edge.us.us, %for.cond122.preheader.lr.ph.us
%indvars.iv401 = phi i64 [ %indvars.iv.next402, %for.cond122.for.inc182_crit_edge.us.us ], [ %indvars.iv399, %for.cond122.preheader.lr.ph.us ]
%flag.1341.us.us = phi i32 [ %flag.3.lcssa.us.us, %for.cond122.for.inc182_crit_edge.us.us ], [ %flag.0351.us, %for.cond122.preheader.lr.ph.us ]
%arrayidx133.us.us = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %indvars.iv401
%num134.us.us = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %indvars.iv401, i32 1
br label %for.body124.us.us
for.body124.us.us: ; preds = %for.cond122.loopexit.us.us, %for.cond122.preheader.us.us
%indvars.iv394 = phi i64 [ %indvars.iv.next395, %for.cond122.loopexit.us.us ], [ 0, %for.cond122.preheader.us.us ]
%indvars.iv387 = phi i64 [ %indvars.iv.next388, %for.cond122.loopexit.us.us ], [ 1, %for.cond122.preheader.us.us ]
%flag.2337.us.us = phi i32 [ %flag.3.lcssa.us.us, %for.cond122.loopexit.us.us ], [ %flag.1341.us.us, %for.cond122.preheader.us.us ]
%indvars.iv.next395 = add nuw nsw i64 %indvars.iv394, 1
%cmp127331.us.us = icmp ult i64 %indvars.iv.next395, %15
br i1 %cmp127331.us.us, label %for.body128.lr.ph.us.us, label %for.cond122.loopexit.us.us
for.cond122.loopexit.us.us: ; preds = %for.inc176.us.us.us, %for.body128.lr.ph.us.us, %for.body124.us.us
%flag.3.lcssa.us.us = phi i32 [ %flag.2337.us.us, %for.body124.us.us ], [ %flag.2337.us.us, %for.body128.lr.ph.us.us ], [ %flag.4.us.us.us, %for.inc176.us.us.us ]
%indvars.iv.next388 = add nuw nsw i64 %indvars.iv387, 1
%exitcond398.not = icmp eq i64 %indvars.iv.next395, %wide.trip.count409
br i1 %exitcond398.not, label %for.cond122.for.inc182_crit_edge.us.us, label %for.body124.us.us, !llvm.loop !17
for.body128.lr.ph.us.us: ; preds = %for.body124.us.us
%16 = load i32, ptr %num131.us, align 4, !tbaa !11
%17 = load i32, ptr %num134.us.us, align 4, !tbaa !11
%cmp135.us.us = icmp eq i32 %16, %17
%arrayidx160.us.us = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %indvars.iv394
%num171.us.us = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %indvars.iv394, i32 1
br i1 %cmp135.us.us, label %for.body128.lr.ph.split.us.us.us, label %for.cond122.loopexit.us.us
for.body128.lr.ph.split.us.us.us: ; preds = %for.body128.lr.ph.us.us
%18 = load i8, ptr %arrayidx130.us, align 8, !tbaa !9
br label %for.body128.us.us.us
for.body128.us.us.us: ; preds = %for.inc176.us.us.us, %for.body128.lr.ph.split.us.us.us
%indvars.iv389 = phi i64 [ %indvars.iv.next390, %for.inc176.us.us.us ], [ %indvars.iv387, %for.body128.lr.ph.split.us.us.us ]
%flag.3333.us.us.us = phi i32 [ %flag.4.us.us.us, %for.inc176.us.us.us ], [ %flag.2337.us.us, %for.body128.lr.ph.split.us.us.us ]
%arrayidx140.us.us.us = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %indvars.iv389
%19 = load i8, ptr %arrayidx140.us.us.us, align 8, !tbaa !9
%cmp143.us.us.us = icmp eq i8 %18, %19
br i1 %cmp143.us.us.us, label %land.lhs.true145.us.us.us, label %for.inc176.us.us.us
land.lhs.true145.us.us.us: ; preds = %for.body128.us.us.us
%num151.us.us.us = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %indvars.iv389, i32 1
%20 = load i32, ptr %num151.us.us.us, align 4, !tbaa !11
%cmp152.us.us.us = icmp eq i32 %16, %20
br i1 %cmp152.us.us.us, label %land.lhs.true154.us.us.us, label %for.inc176.us.us.us
land.lhs.true154.us.us.us: ; preds = %land.lhs.true145.us.us.us
%21 = load i8, ptr %arrayidx133.us.us, align 8, !tbaa !9
%22 = load i8, ptr %arrayidx160.us.us, align 8, !tbaa !9
%cmp163.us.us.us = icmp eq i8 %21, %22
br i1 %cmp163.us.us.us, label %land.lhs.true165.us.us.us, label %for.inc176.us.us.us
land.lhs.true165.us.us.us: ; preds = %land.lhs.true154.us.us.us
%23 = load i32, ptr %num171.us.us, align 4, !tbaa !11
%cmp172.us.us.us = icmp eq i32 %16, %23
%spec.select318.us.us.us = select i1 %cmp172.us.us.us, i32 0, i32 %flag.3333.us.us.us
br label %for.inc176.us.us.us
for.inc176.us.us.us: ; preds = %land.lhs.true165.us.us.us, %land.lhs.true154.us.us.us, %land.lhs.true145.us.us.us, %for.body128.us.us.us
%flag.4.us.us.us = phi i32 [ %flag.3333.us.us.us, %land.lhs.true154.us.us.us ], [ %flag.3333.us.us.us, %land.lhs.true145.us.us.us ], [ %flag.3333.us.us.us, %for.body128.us.us.us ], [ %spec.select318.us.us.us, %land.lhs.true165.us.us.us ]
%indvars.iv.next390 = add nuw nsw i64 %indvars.iv389, 1
%exitcond393.not = icmp eq i64 %indvars.iv.next390, %wide.trip.count409
br i1 %exitcond393.not, label %for.cond122.loopexit.us.us, label %for.body128.us.us.us, !llvm.loop !18
for.cond122.for.inc182_crit_edge.us.us: ; preds = %for.cond122.loopexit.us.us
%indvars.iv.next402 = add nuw nsw i64 %indvars.iv401, 1
%exitcond405.not = icmp eq i64 %indvars.iv.next402, %wide.trip.count409
br i1 %exitcond405.not, label %for.cond116.loopexit.us, label %for.cond122.preheader.us.us, !llvm.loop !19
for.body72: ; preds = %for.cond70.preheader, %for.body72
%indvars.iv381 = phi i64 [ %indvars.iv379, %for.cond70.preheader ], [ %indvars.iv.next382, %for.body72 ]
%minj.0328 = phi i32 [ %14, %for.cond70.preheader ], [ %spec.select, %for.body72 ]
%num75 = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %indvars.iv381, i32 1
%24 = load i32, ptr %num75, align 4, !tbaa !11
%idxprom76 = sext i32 %minj.0328 to i64
%num78 = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %idxprom76, i32 1
%25 = load i32, ptr %num78, align 4, !tbaa !11
%cmp79 = icmp slt i32 %24, %25
%26 = trunc i64 %indvars.iv381 to i32
%spec.select = select i1 %cmp79, i32 %26, i32 %minj.0328
%indvars.iv.next382 = add nuw nsw i64 %indvars.iv381, 1
%cmp71 = icmp ult i64 %indvars.iv.next382, %8
br i1 %cmp71, label %for.body72, label %for.end84, !llvm.loop !20
for.end84: ; preds = %for.body72
%arrayidx86 = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %indvars.iv379
%27 = load i8, ptr %arrayidx86, align 8, !tbaa !9
%num91 = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %indvars.iv379, i32 1
%28 = load i32, ptr %num91, align 4, !tbaa !11
%idxprom93 = sext i32 %spec.select to i64
%arrayidx94 = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %idxprom93
%29 = load i8, ptr %arrayidx94, align 8, !tbaa !9
store i8 %29, ptr %arrayidx86, align 8, !tbaa !9
%num101 = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %idxprom93, i32 1
%30 = load i32, ptr %num101, align 4, !tbaa !11
store i32 %30, ptr %num91, align 4, !tbaa !11
store i8 %27, ptr %arrayidx94, align 8, !tbaa !9
store i32 %28, ptr %num101, align 4, !tbaa !11
%indvars.iv.next380 = add nuw nsw i64 %indvars.iv379, 1
%exitcond386.not = icmp eq i64 %indvars.iv.next380, %wide.trip.count385
br i1 %exitcond386.not, label %for.cond116.preheader, label %for.cond70.preheader, !llvm.loop !21
for.cond188.preheader.loopexit: ; preds = %for.cond116.loopexit.us
%31 = icmp eq i32 %flag.1.lcssa.us, 1
br label %for.cond188.preheader
for.cond188.preheader: ; preds = %for.cond67.preheader, %for.cond188.preheader.loopexit, %for.cond116.preheader
%flag.0.lcssa = phi i1 [ true, %for.cond116.preheader ], [ %31, %for.cond188.preheader.loopexit ], [ true, %for.cond67.preheader ]
%cmp190355 = icmp sgt i32 %6, 1
br i1 %cmp190355, label %for.body192, label %for.cond188.preheader.for.end203_crit_edge
for.cond188.preheader.for.end203_crit_edge: ; preds = %entry, %for.cond16.preheader, %for.cond188.preheader
%flag.0.lcssa427 = phi i1 [ %flag.0.lcssa, %for.cond188.preheader ], [ true, %for.cond16.preheader ], [ true, %entry ]
%32 = phi i32 [ %6, %for.cond188.preheader ], [ %6, %for.cond16.preheader ], [ %0, %entry ]
%sub189354 = add nsw i32 %32, -1
%.pre = sext i32 %sub189354 to i64
br label %for.end203
for.body192: ; preds = %for.cond188.preheader, %for.body192
%indvars.iv411 = phi i64 [ %indvars.iv.next412, %for.body192 ], [ 0, %for.cond188.preheader ]
%arrayidx194 = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %indvars.iv411
%33 = load i8, ptr %arrayidx194, align 8, !tbaa !9
%conv196 = sext i8 %33 to i32
%num199 = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %indvars.iv411, i32 1
%34 = load i32, ptr %num199, align 4, !tbaa !11
%call200 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv196, i32 noundef %34)
%indvars.iv.next412 = add nuw nsw i64 %indvars.iv411, 1
%35 = load i32, ptr %n, align 4, !tbaa !5
%sub189 = add nsw i32 %35, -1
%36 = sext i32 %sub189 to i64
%cmp190 = icmp slt i64 %indvars.iv.next412, %36
br i1 %cmp190, label %for.body192, label %for.end203, !llvm.loop !22
for.end203: ; preds = %for.body192, %for.cond188.preheader.for.end203_crit_edge
%flag.0.lcssa426 = phi i1 [ %flag.0.lcssa427, %for.cond188.preheader.for.end203_crit_edge ], [ %flag.0.lcssa, %for.body192 ]
%idxprom205.pre-phi = phi i64 [ %.pre, %for.cond188.preheader.for.end203_crit_edge ], [ %36, %for.body192 ]
%arrayidx206 = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %idxprom205.pre-phi
%37 = load i8, ptr %arrayidx206, align 8, !tbaa !9
%conv208 = sext i8 %37 to i32
%num212 = getelementptr inbounds [36 x %struct.CARD], ptr %A, i64 0, i64 %idxprom205.pre-phi, i32 1
%38 = load i32, ptr %num212, align 4, !tbaa !11
%call213 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv208, i32 noundef %38)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%39 = load i32, ptr %n, align 4, !tbaa !5
%cmp217359 = icmp sgt i32 %39, 1
br i1 %cmp217359, label %for.body219, label %for.end203.for.end230_crit_edge
for.end203.for.end230_crit_edge: ; preds = %for.end203
%sub216358 = add nsw i32 %39, -1
%.pre417 = sext i32 %sub216358 to i64
br label %for.end230
for.body219: ; preds = %for.end203, %for.body219
%indvars.iv414 = phi i64 [ %indvars.iv.next415, %for.body219 ], [ 0, %for.end203 ]
%arrayidx221 = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %indvars.iv414
%40 = load i8, ptr %arrayidx221, align 8, !tbaa !9
%conv223 = sext i8 %40 to i32
%num226 = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %indvars.iv414, i32 1
%41 = load i32, ptr %num226, align 4, !tbaa !11
%call227 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv223, i32 noundef %41)
%indvars.iv.next415 = add nuw nsw i64 %indvars.iv414, 1
%42 = load i32, ptr %n, align 4, !tbaa !5
%sub216 = add nsw i32 %42, -1
%43 = sext i32 %sub216 to i64
%cmp217 = icmp slt i64 %indvars.iv.next415, %43
br i1 %cmp217, label %for.body219, label %for.end230, !llvm.loop !23
for.end230: ; preds = %for.body219, %for.end203.for.end230_crit_edge
%idxprom232.pre-phi = phi i64 [ %.pre417, %for.end203.for.end230_crit_edge ], [ %43, %for.body219 ]
%arrayidx233 = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %idxprom232.pre-phi
%44 = load i8, ptr %arrayidx233, align 8, !tbaa !9
%conv235 = sext i8 %44 to i32
%num239 = getelementptr inbounds [36 x %struct.CARD], ptr %B, i64 0, i64 %idxprom232.pre-phi, i32 1
%45 = load i32, ptr %num239, align 4, !tbaa !11
%call240 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv235, i32 noundef %45)
%str.7.str.6 = select i1 %flag.0.lcssa426, ptr @str.7, ptr @str.6
%puts316 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.str.6)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !7, i64 0}
!10 = !{!"", !7, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}
!23 = distinct !{!23, !13}
|
#include <stdio.h>
#include <stdlib.h>
struct card {
char mark;
int val;
int index;
};
int
bubble_sort(struct card *C, int N)
{
int i, j;
struct card tmp;
for (i = 0; i < N; i++) {
for (j = N -1; j > i; j--) {
if (C[j].val < C[j - 1].val) {
tmp = C[j];
C[j] = C[j - 1];
C[j - 1] = tmp;
}
}
}
return 0;
}
int
selection_sort(struct card *C, int N)
{
int i, j, minj;
struct card tmp;
for (i = 0; i < N; i++) {
minj = i;
for (j = i; j < N; j++) {
if (C[j].val < C[minj].val)
minj = j;
}
if (C[i].val != C[minj].val) {
tmp = C[i];
C[i] = C[minj];
C[minj] = tmp;
}
}
return 0;
}
void
print_card(struct card *c, int n)
{
int i;
for (i = 0; i < n; i++) {
printf("%c%d", c[i].mark, c[i].val);
if (i != (n - 1))
printf(" ");
}
printf("\n");
}
int
chk_stable(struct card *c, int n) {
int i;
for (i = 0; i < n - 1; i++) {
if (c[i].val == c[i + 1].val) {
if (c[i].index > c[i + 1].index)
return 1;
}
}
return 0;
}
int
main()
{
int N, i, res;
struct card cb[36], cs[36];
char str[4];
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%s", str);
cb[i].mark = str[0];
cs[i].mark = str[0];
cb[i].val = atoi(&str[1]);
cs[i].val = atoi(&str[1]);
cb[i].index = i;
cs[i].index = i;
}
bubble_sort(cb, N);
print_card(cb, N);
res = chk_stable(cb, N);
if (res)
printf("Not stable\n");
else
printf("Stable\n");
selection_sort(cs, N);
print_card(cs, N);
res = chk_stable(cs, N);
if (res)
printf("Not stable\n");
else
printf("Stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113965/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113965/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.card = type { i8, i32, i32 }
@.str = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.9 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @bubble_sort(ptr nocapture noundef %C, i32 noundef %N) local_unnamed_addr #0 {
entry:
%tmp = alloca %struct.card, align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %tmp)
%cmp40 = icmp sgt i32 %N, 0
br i1 %cmp40, label %for.cond1.preheader.lr.ph, label %for.end20
for.cond1.preheader.lr.ph: ; preds = %entry
%j.036 = add nsw i32 %N, -1
%0 = zext i32 %N to i64
%1 = add nsw i64 %0, -1
%2 = zext i32 %j.036 to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc19
%indvars.iv48 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next49, %for.inc19 ]
%cmp237 = icmp ult i64 %indvars.iv48, %2
br i1 %cmp237, label %for.body3, label %for.inc19
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.inc ], [ %0, %for.cond1.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond1.preheader ]
%indvars.iv.next43 = add nsw i64 %indvars.iv42, -1
%val = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv, i32 1
%3 = load i32, ptr %val, align 4, !tbaa !5
%4 = add nsw i64 %indvars.iv42, -2
%val7 = getelementptr inbounds %struct.card, ptr %C, i64 %4, i32 1
%5 = load i32, ptr %val7, align 4, !tbaa !5
%cmp8 = icmp slt i32 %3, %5
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.card, ptr %C, i64 %4
%arrayidx = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %tmp, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx, i64 12, i1 false), !tbaa.struct !10
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx6, i64 12, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx6, ptr noundef nonnull align 4 dereferenceable(12) %tmp, i64 12, i1 false), !tbaa.struct !10
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp2 = icmp sgt i64 %indvars.iv.next, %indvars.iv48
br i1 %cmp2, label %for.body3, label %for.inc19, !llvm.loop !13
for.inc19: ; preds = %for.inc, %for.cond1.preheader
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%exitcond.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.cond1.preheader, !llvm.loop !15
for.end20: ; preds = %for.inc19, %entry
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %tmp)
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @selection_sort(ptr nocapture noundef %C, i32 noundef %N) local_unnamed_addr #0 {
entry:
%tmp = alloca %struct.card, align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %tmp)
%cmp50 = icmp sgt i32 %N, 0
br i1 %cmp50, label %for.cond1.preheader.preheader, label %for.end27
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc25
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.inc25 ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv52 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next53, %for.body3 ]
%minj.049 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%val = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv52, i32 1
%2 = load i32, ptr %val, align 4, !tbaa !5
%idxprom4 = sext i32 %minj.049 to i64
%val6 = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom4, i32 1
%3 = load i32, ptr %val6, align 4, !tbaa !5
%cmp7 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv52 to i32
%spec.select = select i1 %cmp7, i32 %4, i32 %minj.049
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%cmp2 = icmp ult i64 %indvars.iv.next53, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !16
for.end: ; preds = %for.body3
%val10 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv, i32 1
%5 = load i32, ptr %val10, align 4, !tbaa !5
%idxprom11 = sext i32 %spec.select to i64
%val13 = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom11, i32 1
%6 = load i32, ptr %val13, align 4, !tbaa !5
%cmp14.not = icmp eq i32 %5, %6
br i1 %cmp14.not, label %for.inc25, label %if.then15
if.then15: ; preds = %for.end
%arrayidx12 = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom11
%arrayidx9 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %tmp, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx9, i64 12, i1 false), !tbaa.struct !10
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx9, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx12, i64 12, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx12, ptr noundef nonnull align 4 dereferenceable(12) %tmp, i64 12, i1 false), !tbaa.struct !10
br label %for.inc25
for.inc25: ; preds = %for.end, %if.then15
%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.end27, label %for.cond1.preheader, !llvm.loop !17
for.end27: ; preds = %for.inc25, %entry
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %tmp)
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_card(ptr nocapture noundef readonly %c, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp14 = icmp sgt i32 %n, 0
br i1 %cmp14, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%sub = add nsw i32 %n, -1
%0 = zext i32 %sub to i64
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds %struct.card, ptr %c, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 4, !tbaa !18
%conv = sext i8 %1 to i32
%val = getelementptr inbounds %struct.card, ptr %c, i64 %indvars.iv, i32 1
%2 = load i32, ptr %val, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv, i32 noundef %2)
%cmp3.not = icmp eq i64 %indvars.iv, %0
br i1 %cmp3.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%putchar13 = tail call i32 @putchar(i32 32)
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%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.inc, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @chk_stable(ptr nocapture noundef readonly %c, i32 noundef %n) local_unnamed_addr #5 {
entry:
%cmp22 = icmp sgt i32 %n, 1
br i1 %cmp22, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
%wide.trip.count = zext i32 %sub to i64
%val.phi.trans.insert = getelementptr inbounds %struct.card, ptr %c, i64 0, i32 1
%.pre = load i32, ptr %val.phi.trans.insert, align 4, !tbaa !5
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%0 = phi i32 [ %.pre, %for.body.preheader ], [ %1, %for.inc ]
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%val3 = getelementptr inbounds %struct.card, ptr %c, i64 %indvars.iv.next, i32 1
%1 = load i32, ptr %val3, align 4, !tbaa !5
%cmp4 = icmp eq i32 %0, %1
br i1 %cmp4, label %if.then, label %for.inc
if.then: ; preds = %for.body
%index = getelementptr inbounds %struct.card, ptr %c, i64 %indvars.iv, i32 2
%2 = load i32, ptr %index, align 4, !tbaa !20
%index10 = getelementptr inbounds %struct.card, ptr %c, i64 %indvars.iv.next, i32 2
%3 = load i32, ptr %index10, align 4, !tbaa !20
%cmp11 = icmp sgt i32 %2, %3
br i1 %cmp11, label %cleanup, label %for.inc
for.inc: ; preds = %for.body, %if.then
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !21
cleanup: ; preds = %if.then, %for.inc, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.inc ], [ 1, %if.then ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%tmp.i72 = alloca %struct.card, align 4
%tmp.i = alloca %struct.card, align 4
%N = alloca i32, align 4
%cb = alloca [36 x %struct.card], align 16
%cs = alloca [36 x %struct.card], align 16
%str = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #8
call void @llvm.lifetime.start.p0(i64 432, ptr nonnull %cb) #8
call void @llvm.lifetime.start.p0(i64 432, ptr nonnull %cs) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %str) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !12
%cmp123 = icmp sgt i32 %0, 0
br i1 %cmp123, label %for.body.lr.ph, label %for.end.thread
for.end.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %tmp.i)
br label %bubble_sort.exit.thread
for.body.lr.ph: ; preds = %entry
%arrayidx7 = getelementptr inbounds [4 x i8], ptr %str, i64 0, i64 1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %str)
%1 = load i8, ptr %str, align 1, !tbaa !11
%arrayidx2 = getelementptr inbounds [36 x %struct.card], ptr %cb, i64 0, i64 %indvars.iv
store i8 %1, ptr %arrayidx2, align 4, !tbaa !18
%arrayidx5 = getelementptr inbounds [36 x %struct.card], ptr %cs, i64 0, i64 %indvars.iv
store i8 %1, ptr %arrayidx5, align 4, !tbaa !18
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %arrayidx7, ptr noundef null, i32 noundef 10) #8
%conv.i = trunc i64 %call.i to i32
%val = getelementptr inbounds [36 x %struct.card], ptr %cb, i64 0, i64 %indvars.iv, i32 1
store i32 %conv.i, ptr %val, align 4, !tbaa !5
%call.i52 = call i64 @strtol(ptr nocapture noundef nonnull %arrayidx7, ptr noundef null, i32 noundef 10) #8
%conv.i53 = trunc i64 %call.i52 to i32
%val15 = getelementptr inbounds [36 x %struct.card], ptr %cs, i64 0, i64 %indvars.iv, i32 1
store i32 %conv.i53, ptr %val15, align 4, !tbaa !5
%index = getelementptr inbounds [36 x %struct.card], ptr %cb, i64 0, i64 %indvars.iv, i32 2
%2 = trunc i64 %indvars.iv to i32
store i32 %2, ptr %index, align 4, !tbaa !20
%index20 = getelementptr inbounds [36 x %struct.card], ptr %cs, i64 0, i64 %indvars.iv, i32 2
store i32 %2, ptr %index20, align 4, !tbaa !20
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !12
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !22
for.end: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %tmp.i)
%cmp40.i = icmp sgt i32 %3, 0
br i1 %cmp40.i, label %for.cond1.preheader.lr.ph.i, label %bubble_sort.exit.thread
bubble_sort.exit.thread: ; preds = %for.end.thread, %for.end
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %tmp.i)
br label %print_card.exit
for.cond1.preheader.lr.ph.i: ; preds = %for.end
%j.036.i = add nsw i32 %3, -1
%5 = zext i32 %3 to i64
%6 = add nsw i64 %5, -1
%7 = zext i32 %j.036.i to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc19.i, %for.cond1.preheader.lr.ph.i
%indvars.iv48.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next49.i, %for.inc19.i ]
%cmp237.i = icmp ult i64 %indvars.iv48.i, %7
br i1 %cmp237.i, label %for.body3.i, label %for.inc19.i
for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv42.i = phi i64 [ %indvars.iv.next43.i, %for.inc.i ], [ %5, %for.cond1.preheader.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %6, %for.cond1.preheader.i ]
%indvars.iv.next43.i = add nsw i64 %indvars.iv42.i, -1
%val.i = getelementptr inbounds %struct.card, ptr %cb, i64 %indvars.iv.i, i32 1
%8 = load i32, ptr %val.i, align 4, !tbaa !5
%9 = add nsw i64 %indvars.iv42.i, -2
%val7.i = getelementptr inbounds %struct.card, ptr %cb, i64 %9, i32 1
%10 = load i32, ptr %val7.i, align 4, !tbaa !5
%cmp8.i = icmp slt i32 %8, %10
br i1 %cmp8.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.card, ptr %cb, i64 %9
%arrayidx.i = getelementptr inbounds %struct.card, ptr %cb, i64 %indvars.iv.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %tmp.i, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx.i, i64 12, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx.i, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx6.i, i64 12, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx6.i, ptr noundef nonnull align 4 dereferenceable(12) %tmp.i, i64 12, i1 false), !tbaa.struct !10
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%cmp2.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv48.i
br i1 %cmp2.i, label %for.body3.i, label %for.inc19.i, !llvm.loop !13
for.inc19.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.next49.i = add nuw nsw i64 %indvars.iv48.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next49.i, %5
br i1 %exitcond.not.i, label %bubble_sort.exit, label %for.cond1.preheader.i, !llvm.loop !15
bubble_sort.exit: ; preds = %for.inc19.i
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %tmp.i)
br label %for.body.i
for.body.i: ; preds = %for.inc.i61, %bubble_sort.exit
%indvars.iv.i55 = phi i64 [ 0, %bubble_sort.exit ], [ %indvars.iv.next.i62, %for.inc.i61 ]
%arrayidx.i56 = getelementptr inbounds %struct.card, ptr %cb, i64 %indvars.iv.i55
%11 = load i8, ptr %arrayidx.i56, align 4, !tbaa !18
%conv.i57 = sext i8 %11 to i32
%val.i58 = getelementptr inbounds %struct.card, ptr %cb, i64 %indvars.iv.i55, i32 1
%12 = load i32, ptr %val.i58, align 4, !tbaa !5
%call.i59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv.i57, i32 noundef %12)
%cmp3.not.i = icmp eq i64 %indvars.iv.i55, %7
br i1 %cmp3.not.i, label %for.inc.i61, label %if.then.i60
if.then.i60: ; preds = %for.body.i
%putchar13.i = call i32 @putchar(i32 32)
br label %for.inc.i61
for.inc.i61: ; preds = %if.then.i60, %for.body.i
%indvars.iv.next.i62 = add nuw nsw i64 %indvars.iv.i55, 1
%exitcond.not.i63 = icmp eq i64 %indvars.iv.next.i62, %5
br i1 %exitcond.not.i63, label %print_card.exit, label %for.body.i, !llvm.loop !19
print_card.exit: ; preds = %for.inc.i61, %bubble_sort.exit.thread
%putchar.i = call i32 @putchar(i32 10)
%13 = load i32, ptr %N, align 4, !tbaa !12
%cmp22.i = icmp sgt i32 %13, 1
br i1 %cmp22.i, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %print_card.exit
%sub.i64 = add nsw i32 %13, -1
%wide.trip.count.i65 = zext i32 %sub.i64 to i64
%val.phi.trans.insert.i = getelementptr inbounds %struct.card, ptr %cb, i64 0, i32 1
%.pre.i = load i32, ptr %val.phi.trans.insert.i, align 4, !tbaa !5
br label %for.body.i66
for.body.i66: ; preds = %for.inc.i69, %for.body.preheader.i
%14 = phi i32 [ %.pre.i, %for.body.preheader.i ], [ %15, %for.inc.i69 ]
%indvars.iv.i67 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i68, %for.inc.i69 ]
%indvars.iv.next.i68 = add nuw nsw i64 %indvars.iv.i67, 1
%val3.i = getelementptr inbounds %struct.card, ptr %cb, i64 %indvars.iv.next.i68, i32 1
%15 = load i32, ptr %val3.i, align 4, !tbaa !5
%cmp4.i = icmp eq i32 %14, %15
br i1 %cmp4.i, label %if.then.i71, label %for.inc.i69
if.then.i71: ; preds = %for.body.i66
%index.i = getelementptr inbounds %struct.card, ptr %cb, i64 %indvars.iv.i67, i32 2
%16 = load i32, ptr %index.i, align 4, !tbaa !20
%index10.i = getelementptr inbounds %struct.card, ptr %cb, i64 %indvars.iv.next.i68, i32 2
%17 = load i32, ptr %index10.i, align 4, !tbaa !20
%cmp11.i = icmp sgt i32 %16, %17
br i1 %cmp11.i, label %if.end, label %for.inc.i69
for.inc.i69: ; preds = %if.then.i71, %for.body.i66
%exitcond.not.i70 = icmp eq i64 %indvars.iv.next.i68, %wide.trip.count.i65
br i1 %exitcond.not.i70, label %if.end, label %for.body.i66, !llvm.loop !21
if.end: ; preds = %for.inc.i69, %if.then.i71, %print_card.exit
%str.sink = phi ptr [ @str.8, %print_card.exit ], [ @str.9, %if.then.i71 ], [ @str.8, %for.inc.i69 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%18 = load i32, ptr %N, align 4, !tbaa !12
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %tmp.i72)
%cmp50.i = icmp sgt i32 %18, 0
br i1 %cmp50.i, label %for.cond1.preheader.preheader.i, label %selection_sort.exit.thread
selection_sort.exit.thread: ; preds = %if.end
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %tmp.i72)
br label %print_card.exit99
for.cond1.preheader.preheader.i: ; preds = %if.end
%19 = zext i32 %18 to i64
br label %for.cond1.preheader.i74
for.cond1.preheader.i74: ; preds = %for.inc25.i, %for.cond1.preheader.preheader.i
%indvars.iv.i75 = phi i64 [ 0, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next.i79, %for.inc25.i ]
%20 = trunc i64 %indvars.iv.i75 to i32
br label %for.body3.i76
for.body3.i76: ; preds = %for.body3.i76, %for.cond1.preheader.i74
%indvars.iv52.i = phi i64 [ %indvars.iv.i75, %for.cond1.preheader.i74 ], [ %indvars.iv.next53.i, %for.body3.i76 ]
%minj.049.i = phi i32 [ %20, %for.cond1.preheader.i74 ], [ %spec.select.i, %for.body3.i76 ]
%val.i77 = getelementptr inbounds %struct.card, ptr %cs, i64 %indvars.iv52.i, i32 1
%21 = load i32, ptr %val.i77, align 4, !tbaa !5
%idxprom4.i = sext i32 %minj.049.i to i64
%val6.i = getelementptr inbounds %struct.card, ptr %cs, i64 %idxprom4.i, i32 1
%22 = load i32, ptr %val6.i, align 4, !tbaa !5
%cmp7.i = icmp slt i32 %21, %22
%23 = trunc i64 %indvars.iv52.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %23, i32 %minj.049.i
%indvars.iv.next53.i = add nuw nsw i64 %indvars.iv52.i, 1
%cmp2.i78 = icmp ult i64 %indvars.iv.next53.i, %19
br i1 %cmp2.i78, label %for.body3.i76, label %for.end.i, !llvm.loop !16
for.end.i: ; preds = %for.body3.i76
%val10.i = getelementptr inbounds %struct.card, ptr %cs, i64 %indvars.iv.i75, i32 1
%24 = load i32, ptr %val10.i, align 4, !tbaa !5
%idxprom11.i = sext i32 %spec.select.i to i64
%val13.i = getelementptr inbounds %struct.card, ptr %cs, i64 %idxprom11.i, i32 1
%25 = load i32, ptr %val13.i, align 4, !tbaa !5
%cmp14.not.i = icmp eq i32 %24, %25
br i1 %cmp14.not.i, label %for.inc25.i, label %if.then15.i
if.then15.i: ; preds = %for.end.i
%arrayidx12.i = getelementptr inbounds %struct.card, ptr %cs, i64 %idxprom11.i
%arrayidx9.i = getelementptr inbounds %struct.card, ptr %cs, i64 %indvars.iv.i75
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %tmp.i72, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx9.i, i64 12, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx9.i, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx12.i, i64 12, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx12.i, ptr noundef nonnull align 4 dereferenceable(12) %tmp.i72, i64 12, i1 false), !tbaa.struct !10
br label %for.inc25.i
for.inc25.i: ; preds = %if.then15.i, %for.end.i
%indvars.iv.next.i79 = add nuw nsw i64 %indvars.iv.i75, 1
%exitcond.not.i80 = icmp eq i64 %indvars.iv.next.i79, %19
br i1 %exitcond.not.i80, label %selection_sort.exit, label %for.cond1.preheader.i74, !llvm.loop !17
selection_sort.exit: ; preds = %for.inc25.i
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %tmp.i72)
%sub.i85 = add nsw i32 %18, -1
%26 = zext i32 %sub.i85 to i64
br label %for.body.i87
for.body.i87: ; preds = %for.inc.i96, %selection_sort.exit
%indvars.iv.i88 = phi i64 [ 0, %selection_sort.exit ], [ %indvars.iv.next.i97, %for.inc.i96 ]
%arrayidx.i89 = getelementptr inbounds %struct.card, ptr %cs, i64 %indvars.iv.i88
%27 = load i8, ptr %arrayidx.i89, align 4, !tbaa !18
%conv.i90 = sext i8 %27 to i32
%val.i91 = getelementptr inbounds %struct.card, ptr %cs, i64 %indvars.iv.i88, i32 1
%28 = load i32, ptr %val.i91, align 4, !tbaa !5
%call.i92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv.i90, i32 noundef %28)
%cmp3.not.i93 = icmp eq i64 %indvars.iv.i88, %26
br i1 %cmp3.not.i93, label %for.inc.i96, label %if.then.i94
if.then.i94: ; preds = %for.body.i87
%putchar13.i95 = call i32 @putchar(i32 32)
br label %for.inc.i96
for.inc.i96: ; preds = %if.then.i94, %for.body.i87
%indvars.iv.next.i97 = add nuw nsw i64 %indvars.iv.i88, 1
%exitcond.not.i98 = icmp eq i64 %indvars.iv.next.i97, %19
br i1 %exitcond.not.i98, label %print_card.exit99, label %for.body.i87, !llvm.loop !19
print_card.exit99: ; preds = %for.inc.i96, %selection_sort.exit.thread
%putchar.i83 = call i32 @putchar(i32 10)
%29 = load i32, ptr %N, align 4, !tbaa !12
%cmp22.i100 = icmp sgt i32 %29, 1
br i1 %cmp22.i100, label %for.body.preheader.i102, label %if.end38
for.body.preheader.i102: ; preds = %print_card.exit99
%sub.i103 = add nsw i32 %29, -1
%wide.trip.count.i104 = zext i32 %sub.i103 to i64
%val.phi.trans.insert.i105 = getelementptr inbounds %struct.card, ptr %cs, i64 0, i32 1
%.pre.i106 = load i32, ptr %val.phi.trans.insert.i105, align 4, !tbaa !5
br label %for.body.i107
for.body.i107: ; preds = %for.inc.i112, %for.body.preheader.i102
%30 = phi i32 [ %.pre.i106, %for.body.preheader.i102 ], [ %31, %for.inc.i112 ]
%indvars.iv.i108 = phi i64 [ 0, %for.body.preheader.i102 ], [ %indvars.iv.next.i109, %for.inc.i112 ]
%indvars.iv.next.i109 = add nuw nsw i64 %indvars.iv.i108, 1
%val3.i110 = getelementptr inbounds %struct.card, ptr %cs, i64 %indvars.iv.next.i109, i32 1
%31 = load i32, ptr %val3.i110, align 4, !tbaa !5
%cmp4.i111 = icmp eq i32 %30, %31
br i1 %cmp4.i111, label %if.then.i114, label %for.inc.i112
if.then.i114: ; preds = %for.body.i107
%index.i115 = getelementptr inbounds %struct.card, ptr %cs, i64 %indvars.iv.i108, i32 2
%32 = load i32, ptr %index.i115, align 4, !tbaa !20
%index10.i116 = getelementptr inbounds %struct.card, ptr %cs, i64 %indvars.iv.next.i109, i32 2
%33 = load i32, ptr %index10.i116, align 4, !tbaa !20
%cmp11.i117 = icmp sgt i32 %32, %33
br i1 %cmp11.i117, label %if.end38, label %for.inc.i112
for.inc.i112: ; preds = %if.then.i114, %for.body.i107
%exitcond.not.i113 = icmp eq i64 %indvars.iv.next.i109, %wide.trip.count.i104
br i1 %exitcond.not.i113, label %if.end38, label %for.body.i107, !llvm.loop !21
if.end38: ; preds = %for.inc.i112, %if.then.i114, %print_card.exit99
%str.8.sink = phi ptr [ @str.8, %print_card.exit99 ], [ @str.9, %if.then.i114 ], [ @str.8, %for.inc.i112 ]
%puts50 = call i32 @puts(ptr nonnull dereferenceable(1) %str.8.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %str) #8
call void @llvm.lifetime.end.p0(i64 432, ptr nonnull %cs) #8
call void @llvm.lifetime.end.p0(i64 432, ptr nonnull %cb) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) 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
attributes #0 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !9, i64 4}
!6 = !{!"card", !7, i64 0, !9, i64 4, !9, i64 8}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{i64 0, i64 1, !11, i64 4, i64 4, !12, i64 8, i64 4, !12}
!11 = !{!7, !7, i64 0}
!12 = !{!9, !9, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = !{!6, !7, i64 0}
!19 = distinct !{!19, !14}
!20 = !{!6, !9, i64 8}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}
|
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int selectionSort(char A[50][3], int N)
{
int minj;
int i,j;
char tmp[3];
for(i=0;i<N;i++){
minj=i;
for(j=i+1;j<N;j++){
if(A[j][1]<A[minj][1]){
minj=j;
}
}
if(i!=minj){
strcpy(tmp,A[i]);//tmp = A[i];
strcpy(A[i],A[minj]);//A[i]=A[minj];
strcpy(A[minj],tmp);//A[minj]=tmp;
//cnt++;
}
}
//printf("%s %s %s\n",A[0],A[1],tmp);
return 0;
}
static int cnt;
int bubbleSort(char A[50][3], int N)
{
int flag=1;
int i;
char tmp[3];
while(flag){
flag = 0;
for(i=N-1;i>0;i--){
if(A[i][1]<A[i-1][1]){
strcpy(tmp,A[i]);//tmp = A[i];
strcpy(A[i],A[i-1]);//A[i]=A[i-1];
strcpy(A[i-1],tmp);//A[i-1]=tmp;
flag=1;
//cnt++;
}
}
}
return 0;
}
int
main(){
int N;
char B[50][3];char C[50][3];
int s_stable=0;
scanf("%d",&N);
int i;
for(i=0;i<N;i++){
scanf("%s",B[i]);
strcpy(C[i],B[i]);
}
//////////////////////////////////////
bubbleSort(C,N);
s_stable=0;
for(i=0;i<N;i++){
if(i<N-1)printf("%s ",C[i]);
else printf("%s\n",C[i]);
}
printf("%s\n",(s_stable>0? "Not stable":"Stable"));
///////////////////////////////////////
selectionSort(B,N);
for(i=0;i<N;i++){
if(i<N-1)printf("%s ",B[i]);
else printf("%s\n",B[i]);
if(B[i][0]!=C[i][0]) s_stable++;
}
printf("%s\n",(s_stable>0? "Not stable":"Stable"));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114007/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114007/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%s \00", align 1
@.str.4 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@.str.5 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @selectionSort(ptr noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%tmp = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %tmp) #6
%cmp54 = icmp sgt i32 %N, 0
br i1 %cmp54, label %for.body.preheader, label %for.end32
for.body.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count62 = zext i32 %N to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc30
%indvars.iv59 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next60, %for.inc30 ]
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.inc30 ]
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%cmp251 = icmp ult i64 %indvars.iv.next60, %0
%1 = trunc i64 %indvars.iv59 to i32
br i1 %cmp251, label %for.body3, label %for.end
for.body3: ; preds = %for.body, %for.body3
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body3 ], [ %indvars.iv, %for.body ]
%minj.052 = phi i32 [ %spec.select, %for.body3 ], [ %1, %for.body ]
%arrayidx4 = getelementptr inbounds [3 x i8], ptr %A, i64 %indvars.iv56, i64 1
%2 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%idxprom5 = sext i32 %minj.052 to i64
%arrayidx7 = getelementptr inbounds [3 x i8], ptr %A, i64 %idxprom5, i64 1
%3 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv56 to i32
%spec.select = select i1 %cmp9, i32 %4, i32 %minj.052
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%exitcond.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count62
br i1 %exitcond.not, label %for.end, label %for.body3, !llvm.loop !8
for.end: ; preds = %for.body3, %for.body
%minj.0.lcssa = phi i32 [ %1, %for.body ], [ %spec.select, %for.body3 ]
%5 = zext i32 %minj.0.lcssa to i64
%cmp11.not = icmp eq i64 %indvars.iv59, %5
br i1 %cmp11.not, label %for.inc30, label %if.then13
if.then13: ; preds = %for.end
%arrayidx15 = getelementptr inbounds [3 x i8], ptr %A, i64 %indvars.iv59
%call = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %tmp, ptr noundef nonnull dereferenceable(1) %arrayidx15) #6
%idxprom20 = sext i32 %minj.0.lcssa to i64
%arrayidx21 = getelementptr inbounds [3 x i8], ptr %A, i64 %idxprom20
%call23 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx15, ptr noundef nonnull dereferenceable(1) %arrayidx21) #6
%call28 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx21, ptr noundef nonnull dereferenceable(1) %tmp) #6
br label %for.inc30
for.inc30: ; preds = %for.end, %if.then13
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond63.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count62
br i1 %exitcond63.not, label %for.end32, label %for.body, !llvm.loop !10
for.end32: ; preds = %for.inc30, %entry
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %tmp) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @bubbleSort(ptr noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%tmp = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %tmp) #6
%cmp39 = icmp sgt i32 %N, 1
br i1 %cmp39, label %for.cond.preheader.us.preheader, label %while.end
for.cond.preheader.us.preheader: ; preds = %entry
%0 = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.backedge, %for.cond.preheader.us.preheader
%indvars.iv = phi i64 [ %0, %for.cond.preheader.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ]
%flag.140.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %flag.140.us.be, %for.body.us.backedge ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%idxprom.us = and i64 %indvars.iv.next, 4294967295
%arrayidx1.us = getelementptr inbounds [3 x i8], ptr %A, i64 %idxprom.us, i64 1
%1 = load i8, ptr %arrayidx1.us, align 1, !tbaa !5
%sub2.us = add i64 %indvars.iv, 4294967294
%idxprom3.us = and i64 %sub2.us, 4294967295
%arrayidx5.us = getelementptr inbounds [3 x i8], ptr %A, i64 %idxprom3.us, i64 1
%2 = load i8, ptr %arrayidx5.us, align 1, !tbaa !5
%cmp7.us = icmp slt i8 %1, %2
br i1 %cmp7.us, label %if.then.us, label %for.inc.us
if.then.us: ; preds = %for.body.us
%arrayidx4.us = getelementptr inbounds [3 x i8], ptr %A, i64 %idxprom3.us
%arrayidx.us = getelementptr inbounds [3 x i8], ptr %A, i64 %idxprom.us
%call.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %tmp, ptr noundef nonnull dereferenceable(1) %arrayidx.us) #6
%call19.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx.us, ptr noundef nonnull dereferenceable(1) %arrayidx4.us) #6
%call25.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx4.us, ptr noundef nonnull dereferenceable(1) %tmp) #6
br label %for.inc.us
for.inc.us: ; preds = %if.then.us, %for.body.us
%flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.140.us, %for.body.us ]
%cmp.us = icmp sgt i64 %indvars.iv, 2
br i1 %cmp.us, label %for.body.us.backedge, label %for.cond.while.cond.loopexit_crit_edge.us
for.body.us.backedge: ; preds = %for.inc.us, %for.cond.while.cond.loopexit_crit_edge.us
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ %0, %for.cond.while.cond.loopexit_crit_edge.us ]
%flag.140.us.be = phi i32 [ %flag.2.us, %for.inc.us ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us ]
br label %for.body.us, !llvm.loop !11
for.cond.while.cond.loopexit_crit_edge.us: ; preds = %for.inc.us
%tobool.not.us = icmp eq i32 %flag.2.us, 0
br i1 %tobool.not.us, label %while.end, label %for.body.us.backedge
while.end: ; preds = %for.cond.while.cond.loopexit_crit_edge.us, %entry
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %tmp) #6
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%tmp.i88 = alloca [3 x i8], align 1
%tmp.i = alloca [3 x i8], align 1
%N = alloca i32, align 4
%B = alloca [50 x [3 x i8]], align 16
%C = alloca [50 x [3 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 150, ptr nonnull %B) #6
call void @llvm.lifetime.start.p0(i64 150, ptr nonnull %C) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !12
%cmp91 = icmp sgt i32 %0, 0
br i1 %cmp91, label %for.body, label %for.end25
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x [3 x i8]], ptr %B, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%arrayidx3 = getelementptr inbounds [50 x [3 x i8]], ptr %C, i64 0, i64 %indvars.iv
%call8 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx3, ptr noundef nonnull dereferenceable(1) %arrayidx) #6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !12
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %tmp.i) #6
%cmp39.i = icmp sgt i32 %1, 1
br i1 %cmp39.i, label %for.cond.preheader.us.preheader.i, label %bubbleSort.exit
for.cond.preheader.us.preheader.i: ; preds = %for.end
%3 = zext i32 %1 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.body.us.i.backedge, %for.cond.preheader.us.preheader.i
%indvars.iv.i = phi i64 [ %3, %for.cond.preheader.us.preheader.i ], [ %indvars.iv.i.be, %for.body.us.i.backedge ]
%flag.140.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %flag.140.us.i.be, %for.body.us.i.backedge ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%idxprom.us.i = and i64 %indvars.iv.next.i, 4294967295
%arrayidx1.us.i = getelementptr inbounds [3 x i8], ptr %C, i64 %idxprom.us.i, i64 1
%4 = load i8, ptr %arrayidx1.us.i, align 1, !tbaa !5
%sub2.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294
%idxprom3.us.i = and i64 %sub2.us.i, 4294967295
%arrayidx5.us.i = getelementptr inbounds [3 x i8], ptr %C, i64 %idxprom3.us.i, i64 1
%5 = load i8, ptr %arrayidx5.us.i, align 1, !tbaa !5
%cmp7.us.i = icmp slt i8 %4, %5
br i1 %cmp7.us.i, label %if.then.us.i, label %for.inc.us.i
if.then.us.i: ; preds = %for.body.us.i
%arrayidx4.us.i = getelementptr inbounds [3 x i8], ptr %C, i64 %idxprom3.us.i
%arrayidx.us.i = getelementptr inbounds [3 x i8], ptr %C, i64 %idxprom.us.i
%call.us.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %tmp.i, ptr noundef nonnull dereferenceable(1) %arrayidx.us.i) #6
%call19.us.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx.us.i, ptr noundef nonnull dereferenceable(1) %arrayidx4.us.i) #6
%call25.us.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx4.us.i, ptr noundef nonnull dereferenceable(1) %tmp.i) #6
br label %for.inc.us.i
for.inc.us.i: ; preds = %if.then.us.i, %for.body.us.i
%flag.2.us.i = phi i32 [ 1, %if.then.us.i ], [ %flag.140.us.i, %for.body.us.i ]
%cmp.us.i = icmp sgt i64 %indvars.iv.i, 2
br i1 %cmp.us.i, label %for.body.us.i.backedge, label %for.cond.while.cond.loopexit_crit_edge.us.i
for.body.us.i.backedge: ; preds = %for.inc.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i
%indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %for.inc.us.i ], [ %3, %for.cond.while.cond.loopexit_crit_edge.us.i ]
%flag.140.us.i.be = phi i32 [ %flag.2.us.i, %for.inc.us.i ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us.i ]
br label %for.body.us.i, !llvm.loop !11
for.cond.while.cond.loopexit_crit_edge.us.i: ; preds = %for.inc.us.i
%tobool.not.us.i = icmp eq i32 %flag.2.us.i, 0
br i1 %tobool.not.us.i, label %bubbleSort.exit, label %for.body.us.i.backedge
bubbleSort.exit: ; preds = %for.cond.while.cond.loopexit_crit_edge.us.i, %for.end
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %tmp.i) #6
%cmp1293 = icmp sgt i32 %1, 0
br i1 %cmp1293, label %for.body13, label %for.end25
for.body13: ; preds = %bubbleSort.exit, %for.inc23
%indvars.iv101 = phi i64 [ %indvars.iv.next102, %for.inc23 ], [ 0, %bubbleSort.exit ]
%6 = phi i32 [ %8, %for.inc23 ], [ %1, %bubbleSort.exit ]
%sub = add nsw i32 %6, -1
%7 = sext i32 %sub to i64
%cmp14 = icmp slt i64 %indvars.iv101, %7
%arrayidx16 = getelementptr inbounds [50 x [3 x i8]], ptr %C, i64 0, i64 %indvars.iv101
br i1 %cmp14, label %if.then, label %if.else
if.then: ; preds = %for.body13
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx16)
br label %for.inc23
if.else: ; preds = %for.body13
%puts87 = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx16)
br label %for.inc23
for.inc23: ; preds = %if.then, %if.else
%indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
%8 = load i32, ptr %N, align 4, !tbaa !12
%9 = sext i32 %8 to i64
%cmp12 = icmp slt i64 %indvars.iv.next102, %9
br i1 %cmp12, label %for.body13, label %for.end25, !llvm.loop !15
for.end25: ; preds = %for.inc23, %entry, %bubbleSort.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @.str.5)
%10 = load i32, ptr %N, align 4, !tbaa !12
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %tmp.i88) #6
%cmp54.i = icmp sgt i32 %10, 0
br i1 %cmp54.i, label %for.body.preheader.i, label %selectionSort.exit.thread
selectionSort.exit.thread: ; preds = %for.end25
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %tmp.i88) #6
br label %for.end60
for.body.preheader.i: ; preds = %for.end25
%11 = zext i32 %10 to i64
br label %for.body.i
for.body.i: ; preds = %for.inc30.i, %for.body.preheader.i
%indvars.iv59.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next60.i, %for.inc30.i ]
%indvars.iv.i89 = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i90, %for.inc30.i ]
%indvars.iv.next60.i = add nuw nsw i64 %indvars.iv59.i, 1
%cmp251.i = icmp ult i64 %indvars.iv.next60.i, %11
%12 = trunc i64 %indvars.iv59.i to i32
br i1 %cmp251.i, label %for.body3.i, label %for.end.i
for.body3.i: ; preds = %for.body.i, %for.body3.i
%indvars.iv56.i = phi i64 [ %indvars.iv.next57.i, %for.body3.i ], [ %indvars.iv.i89, %for.body.i ]
%minj.052.i = phi i32 [ %spec.select.i, %for.body3.i ], [ %12, %for.body.i ]
%arrayidx4.i = getelementptr inbounds [3 x i8], ptr %B, i64 %indvars.iv56.i, i64 1
%13 = load i8, ptr %arrayidx4.i, align 1, !tbaa !5
%idxprom5.i = sext i32 %minj.052.i to i64
%arrayidx7.i = getelementptr inbounds [3 x i8], ptr %B, i64 %idxprom5.i, i64 1
%14 = load i8, ptr %arrayidx7.i, align 1, !tbaa !5
%cmp9.i = icmp slt i8 %13, %14
%15 = trunc i64 %indvars.iv56.i to i32
%spec.select.i = select i1 %cmp9.i, i32 %15, i32 %minj.052.i
%indvars.iv.next57.i = add nuw nsw i64 %indvars.iv56.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next57.i, %11
br i1 %exitcond.not.i, label %for.end.i, label %for.body3.i, !llvm.loop !8
for.end.i: ; preds = %for.body3.i, %for.body.i
%minj.0.lcssa.i = phi i32 [ %12, %for.body.i ], [ %spec.select.i, %for.body3.i ]
%16 = zext i32 %minj.0.lcssa.i to i64
%cmp11.not.i = icmp eq i64 %indvars.iv59.i, %16
br i1 %cmp11.not.i, label %for.inc30.i, label %if.then13.i
if.then13.i: ; preds = %for.end.i
%arrayidx15.i = getelementptr inbounds [3 x i8], ptr %B, i64 %indvars.iv59.i
%call.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %tmp.i88, ptr noundef nonnull dereferenceable(1) %arrayidx15.i) #6
%idxprom20.i = sext i32 %minj.0.lcssa.i to i64
%arrayidx21.i = getelementptr inbounds [3 x i8], ptr %B, i64 %idxprom20.i
%call23.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx15.i, ptr noundef nonnull dereferenceable(1) %arrayidx21.i) #6
%call28.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx21.i, ptr noundef nonnull dereferenceable(1) %tmp.i88) #6
br label %for.inc30.i
for.inc30.i: ; preds = %if.then13.i, %for.end.i
%indvars.iv.next.i90 = add nuw nsw i64 %indvars.iv.i89, 1
%exitcond63.not.i = icmp eq i64 %indvars.iv.next60.i, %11
br i1 %exitcond63.not.i, label %selectionSort.exit, label %for.body.i, !llvm.loop !10
selectionSort.exit: ; preds = %for.inc30.i
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %tmp.i88) #6
br i1 %cmp54.i, label %for.body32, label %for.end60
for.body32: ; preds = %selectionSort.exit, %if.end45
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %if.end45 ], [ 0, %selectionSort.exit ]
%17 = phi i32 [ %21, %if.end45 ], [ %10, %selectionSort.exit ]
%s_stable.096 = phi i32 [ %spec.select, %if.end45 ], [ 0, %selectionSort.exit ]
%sub33 = add nsw i32 %17, -1
%18 = sext i32 %sub33 to i64
%cmp34 = icmp slt i64 %indvars.iv104, %18
%arrayidx37 = getelementptr inbounds [50 x [3 x i8]], ptr %B, i64 0, i64 %indvars.iv104
br i1 %cmp34, label %if.then35, label %if.else40
if.then35: ; preds = %for.body32
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx37)
br label %if.end45
if.else40: ; preds = %for.body32
%puts86 = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx37)
br label %if.end45
if.end45: ; preds = %if.else40, %if.then35
%arrayidx47 = getelementptr inbounds [50 x [3 x i8]], ptr %B, i64 0, i64 %indvars.iv104
%19 = load i8, ptr %arrayidx47, align 1, !tbaa !5
%arrayidx50 = getelementptr inbounds [50 x [3 x i8]], ptr %C, i64 0, i64 %indvars.iv104
%20 = load i8, ptr %arrayidx50, align 1, !tbaa !5
%cmp53.not = icmp ne i8 %19, %20
%inc56 = zext i1 %cmp53.not to i32
%spec.select = add nuw nsw i32 %s_stable.096, %inc56
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%21 = load i32, ptr %N, align 4, !tbaa !12
%22 = sext i32 %21 to i64
%cmp31 = icmp slt i64 %indvars.iv.next105, %22
br i1 %cmp31, label %for.body32, label %for.end60.loopexit, !llvm.loop !16
for.end60.loopexit: ; preds = %if.end45
%.not = icmp eq i32 %spec.select, 0
%23 = select i1 %.not, ptr @.str.5, ptr @.str.4
br label %for.end60
for.end60: ; preds = %selectionSort.exit.thread, %for.end60.loopexit, %selectionSort.exit
%s_stable.0.lcssa = phi ptr [ @.str.5, %selectionSort.exit ], [ %23, %for.end60.loopexit ], [ @.str.5, %selectionSort.exit.thread ]
%puts85 = call i32 @puts(ptr nonnull dereferenceable(1) %s_stable.0.lcssa)
call void @llvm.lifetime.end.p0(i64 150, ptr nonnull %C) #6
call void @llvm.lifetime.end.p0(i64 150, ptr nonnull %B) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !6, i64 0}
!14 = distinct !{!14, !9}
!15 = distinct !{!15, !9}
!16 = distinct !{!16, !9}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define TRUE 1
#define FALSE 0
typedef struct _card {
char mark;
int value;
} card ;
void isstable(card *targetc, card *c, int N) {
int sw = TRUE;
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
for (int a = 0; a < N; a++) {
for (int b = a + 1; b < N; b++) {
if (c[i].value == c[j].value && c[i].value == targetc[a].value && c[i].value == targetc[b].value
&& c[i].mark == targetc[b].mark && c[j].mark == targetc[a].mark) {
sw = FALSE;
}
}
}
}
}
if (sw) {
printf("\nStable\n");
}
else {
printf("\nNot stable\n");
}
}
void babblesort(card *c, int N) {
card babblec[36];
for (int i = 0; i < N; i++) {
babblec[i] = c[i];
}
for (int i = 0; i < N; i++) {
for (int j = N - 1; j > i; j--) {
if (babblec[j].value < babblec[j-1].value) {
card tmp = babblec[j];
babblec[j] = babblec[j-1];
babblec[j - 1] = tmp;
}
}
}
for (int i = 0; i < N; i++) {
if (i) {
printf(" ");
}
printf("%c%d", babblec[i].mark, babblec[i].value);
}
isstable(babblec, c, N);
}
void selectsort(card *c, int N) {
card selectc[36];
for (int i = 0; i < N; i++) {
selectc[i] = c[i];
}
for (int i = 0; i < N; i++) {
int minj = i;
for (int j = i + 1; j < N; j++) {
if (selectc[minj].value > selectc[j].value) {
minj = j;
}
}
card tmp = selectc[i];
selectc[i] = selectc[minj];
selectc[minj] = tmp;
}
for (int i = 0; i < N; i++) {
if (i) {
printf(" ");
}
printf("%c%d", selectc[i].mark, selectc[i].value);
}
isstable(selectc, c, N);
}
int main(void) {
int N;
card c[36];
scanf("%d\n", &N);
for (int i = 0; i < N; i++) {
if (i) {
scanf(" ");
}
scanf("%c%d", &(c[i].mark), &(c[i].value));
}
babblesort(c, N);
selectsort(c, N);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114050/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114050/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._card = type { i8, i32 }
@.str.2 = private unnamed_addr constant [2 x i8] c" \00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%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 [12 x i8] c"\0ANot stable\00", align 1
@str.5 = private unnamed_addr constant [8 x i8] c"\0AStable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @isstable(ptr nocapture noundef readonly %targetc, ptr nocapture noundef readonly %c, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp117 = icmp sgt i32 %N, 0
br i1 %cmp117, label %for.body.us.preheader, label %if.end64
for.body.us.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count141 = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond.loopexit.us
%indvars.iv138 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next139, %for.cond.loopexit.us ]
%indvars.iv131 = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next132, %for.cond.loopexit.us ]
%sw.0118.us = phi i32 [ 1, %for.body.us.preheader ], [ %sw.1.lcssa.us, %for.cond.loopexit.us ]
%indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
%cmp2100.us = icmp ult i64 %indvars.iv.next139, %0
br i1 %cmp2100.us, label %for.cond5.preheader.lr.ph.us, label %for.cond.loopexit.us
for.cond.loopexit.us: ; preds = %for.cond5.for.cond.cleanup7_crit_edge.us.us, %for.body.us
%sw.1.lcssa.us = phi i32 [ %sw.0118.us, %for.body.us ], [ %sw.3.lcssa.us.us, %for.cond5.for.cond.cleanup7_crit_edge.us.us ]
%indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
%exitcond142.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count141
br i1 %exitcond142.not, label %for.cond.cleanup, label %for.body.us, !llvm.loop !5
for.cond5.preheader.lr.ph.us: ; preds = %for.body.us
%arrayidx.us = getelementptr inbounds %struct._card, ptr %c, i64 %indvars.iv138
%value.us = getelementptr inbounds %struct._card, ptr %c, i64 %indvars.iv138, i32 1
br label %for.cond5.preheader.us.us
for.cond5.preheader.us.us: ; preds = %for.cond5.for.cond.cleanup7_crit_edge.us.us, %for.cond5.preheader.lr.ph.us
%indvars.iv133 = phi i64 [ %indvars.iv.next134, %for.cond5.for.cond.cleanup7_crit_edge.us.us ], [ %indvars.iv131, %for.cond5.preheader.lr.ph.us ]
%sw.1101.us.us = phi i32 [ %sw.3.lcssa.us.us, %for.cond5.for.cond.cleanup7_crit_edge.us.us ], [ %sw.0118.us, %for.cond5.preheader.lr.ph.us ]
%arrayidx15.us.us = getelementptr inbounds %struct._card, ptr %c, i64 %indvars.iv133
%value16.us.us = getelementptr inbounds %struct._card, ptr %c, i64 %indvars.iv133, i32 1
br label %for.body8.us.us
for.body8.us.us: ; preds = %for.cond5.loopexit.us.us, %for.cond5.preheader.us.us
%indvars.iv126 = phi i64 [ %indvars.iv.next127, %for.cond5.loopexit.us.us ], [ 0, %for.cond5.preheader.us.us ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond5.loopexit.us.us ], [ 1, %for.cond5.preheader.us.us ]
%sw.298.us.us = phi i32 [ %sw.3.lcssa.us.us, %for.cond5.loopexit.us.us ], [ %sw.1101.us.us, %for.cond5.preheader.us.us ]
%indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
%cmp1193.us.us = icmp ult i64 %indvars.iv.next127, %0
br i1 %cmp1193.us.us, label %for.body13.lr.ph.us.us, label %for.cond5.loopexit.us.us
for.cond5.loopexit.us.us: ; preds = %for.inc.us.us.us.us, %for.body13.lr.ph.split.us.us.us, %for.body13.lr.ph.us.us, %for.body8.us.us
%sw.3.lcssa.us.us = phi i32 [ %sw.298.us.us, %for.body8.us.us ], [ %sw.298.us.us, %for.body13.lr.ph.us.us ], [ %sw.298.us.us, %for.body13.lr.ph.split.us.us.us ], [ %sw.4.us.us.us.us, %for.inc.us.us.us.us ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond130.not = icmp eq i64 %indvars.iv.next127, %wide.trip.count141
br i1 %exitcond130.not, label %for.cond5.for.cond.cleanup7_crit_edge.us.us, label %for.body8.us.us, !llvm.loop !7
for.body13.lr.ph.us.us: ; preds = %for.body8.us.us
%1 = load i32, ptr %value.us, align 4, !tbaa !8
%2 = load i32, ptr %value16.us.us, align 4, !tbaa !8
%cmp17.us.us = icmp eq i32 %1, %2
%arrayidx22.us.us = getelementptr inbounds %struct._card, ptr %targetc, i64 %indvars.iv126
br i1 %cmp17.us.us, label %for.body13.lr.ph.split.us.us.us, label %for.cond5.loopexit.us.us
for.body13.lr.ph.split.us.us.us: ; preds = %for.body13.lr.ph.us.us
%value23.us.us = getelementptr inbounds %struct._card, ptr %targetc, i64 %indvars.iv126, i32 1
%3 = load i32, ptr %value23.us.us, align 4, !tbaa !8
%cmp24.us.us.us = icmp eq i32 %1, %3
br i1 %cmp24.us.us.us, label %for.body13.us.us.us.us, label %for.cond5.loopexit.us.us
for.body13.us.us.us.us: ; preds = %for.body13.lr.ph.split.us.us.us, %for.inc.us.us.us.us
%indvars.iv123 = phi i64 [ %indvars.iv.next124, %for.inc.us.us.us.us ], [ %indvars.iv, %for.body13.lr.ph.split.us.us.us ]
%sw.394.us.us.us.us = phi i32 [ %sw.4.us.us.us.us, %for.inc.us.us.us.us ], [ %sw.298.us.us, %for.body13.lr.ph.split.us.us.us ]
%value31.us.us.us.us = getelementptr inbounds %struct._card, ptr %targetc, i64 %indvars.iv123, i32 1
%4 = load i32, ptr %value31.us.us.us.us, align 4, !tbaa !8
%cmp32.us.us.us.us = icmp eq i32 %1, %4
br i1 %cmp32.us.us.us.us, label %land.lhs.true33.us.us.us.us, label %for.inc.us.us.us.us
land.lhs.true33.us.us.us.us: ; preds = %for.body13.us.us.us.us
%arrayidx30.us.us.us.us = getelementptr inbounds %struct._card, ptr %targetc, i64 %indvars.iv123
%5 = load i8, ptr %arrayidx.us, align 4, !tbaa !13
%6 = load i8, ptr %arrayidx30.us.us.us.us, align 4, !tbaa !13
%cmp40.us.us.us.us = icmp eq i8 %5, %6
br i1 %cmp40.us.us.us.us, label %land.lhs.true42.us.us.us.us, label %for.inc.us.us.us.us
land.lhs.true42.us.us.us.us: ; preds = %land.lhs.true33.us.us.us.us
%7 = load i8, ptr %arrayidx15.us.us, align 4, !tbaa !13
%8 = load i8, ptr %arrayidx22.us.us, align 4, !tbaa !13
%cmp51.us.us.us.us = icmp eq i8 %7, %8
%spec.select.us.us.us.us = select i1 %cmp51.us.us.us.us, i32 0, i32 %sw.394.us.us.us.us
br label %for.inc.us.us.us.us
for.inc.us.us.us.us: ; preds = %land.lhs.true42.us.us.us.us, %land.lhs.true33.us.us.us.us, %for.body13.us.us.us.us
%sw.4.us.us.us.us = phi i32 [ %sw.394.us.us.us.us, %land.lhs.true33.us.us.us.us ], [ %sw.394.us.us.us.us, %for.body13.us.us.us.us ], [ %spec.select.us.us.us.us, %land.lhs.true42.us.us.us.us ]
%indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
%exitcond.not = icmp eq i64 %indvars.iv.next124, %wide.trip.count141
br i1 %exitcond.not, label %for.cond5.loopexit.us.us, label %for.body13.us.us.us.us, !llvm.loop !14
for.cond5.for.cond.cleanup7_crit_edge.us.us: ; preds = %for.cond5.loopexit.us.us
%indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
%exitcond137.not = icmp eq i64 %indvars.iv.next134, %wide.trip.count141
br i1 %exitcond137.not, label %for.cond.loopexit.us, label %for.cond5.preheader.us.us, !llvm.loop !15
for.cond.cleanup: ; preds = %for.cond.loopexit.us
%9 = icmp eq i32 %sw.1.lcssa.us, 0
%spec.select = select i1 %9, ptr @str, ptr @str.5
br label %if.end64
if.end64: ; preds = %for.cond.cleanup, %entry
%str.sink = phi ptr [ @str.5, %entry ], [ %spec.select, %for.cond.cleanup ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
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 void @babblesort(ptr nocapture noundef readonly %c, i32 noundef %N) local_unnamed_addr #0 {
entry:
%babblec = alloca [36 x %struct._card], align 16
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %babblec) #5
%cmp71 = icmp sgt i32 %N, 0
br i1 %cmp71, label %for.cond8.preheader.lr.ph, label %isstable.exit
for.cond8.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %N to i64
%1 = shl nuw nsw i64 %0, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %babblec, ptr align 4 %c, i64 %1, i1 false)
%j.073 = add nsw i32 %N, -1
%2 = zext i32 %N to i64
%3 = add nsw i64 %2, -1
%4 = zext i32 %j.073 to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.cond8.preheader.lr.ph, %for.cond.cleanup10
%indvars.iv88 = phi i64 [ 0, %for.cond8.preheader.lr.ph ], [ %indvars.iv.next89, %for.cond.cleanup10 ]
%cmp974 = icmp ult i64 %indvars.iv88, %4
br i1 %cmp974, label %for.body11, label %for.cond.cleanup10
for.cond35.preheader: ; preds = %for.cond.cleanup10
br i1 %cmp71, label %if.end40.peel, label %isstable.exit
if.end40.peel: ; preds = %for.cond35.preheader
%wide.trip.count94 = zext i32 %N to i64
%5 = load i8, ptr %babblec, align 16, !tbaa !13
%conv.peel = sext i8 %5 to i32
%value45.peel = getelementptr inbounds [36 x %struct._card], ptr %babblec, i64 0, i64 0, i32 1
%6 = load i32, ptr %value45.peel, align 4, !tbaa !8
%call46.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.peel, i32 noundef %6)
%exitcond95.peel.not = icmp eq i32 %N, 1
br i1 %exitcond95.peel.not, label %for.body.us.preheader.i, label %if.end40
for.cond.cleanup10: ; preds = %for.inc29, %for.cond8.preheader
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%exitcond.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count
br i1 %exitcond.not, label %for.cond35.preheader, label %for.cond8.preheader, !llvm.loop !16
for.body11: ; preds = %for.cond8.preheader, %for.inc29
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %for.inc29 ], [ %2, %for.cond8.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc29 ], [ %3, %for.cond8.preheader ]
%indvars.iv.next83 = add nsw i64 %indvars.iv82, -1
%value = getelementptr inbounds [36 x %struct._card], ptr %babblec, i64 0, i64 %indvars.iv, i32 1
%7 = load i32, ptr %value, align 4, !tbaa !8
%8 = add nsw i64 %indvars.iv82, -2
%value17 = getelementptr inbounds [36 x %struct._card], ptr %babblec, i64 0, i64 %8, i32 1
%9 = load i32, ptr %value17, align 4, !tbaa !8
%cmp18 = icmp slt i32 %7, %9
br i1 %cmp18, label %if.then, label %for.inc29
if.then: ; preds = %for.body11
%arrayidx16 = getelementptr inbounds [36 x %struct._card], ptr %babblec, i64 0, i64 %8
%arrayidx13 = getelementptr inbounds [36 x %struct._card], ptr %babblec, i64 0, i64 %indvars.iv
%10 = load i64, ptr %arrayidx13, align 8
%11 = load i64, ptr %arrayidx16, align 8
store i64 %11, ptr %arrayidx13, align 8
store i64 %10, ptr %arrayidx16, align 8
br label %for.inc29
for.inc29: ; preds = %for.body11, %if.then
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp9 = icmp sgt i64 %indvars.iv.next, %indvars.iv88
br i1 %cmp9, label %for.body11, label %for.cond.cleanup10, !llvm.loop !17
for.cond.cleanup37: ; preds = %if.end40
br i1 %cmp71, label %for.body.us.preheader.i, label %isstable.exit
for.body.us.preheader.i: ; preds = %if.end40.peel, %for.cond.cleanup37
%12 = zext i32 %N to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv138.i = phi i64 [ 0, %for.body.us.preheader.i ], [ %indvars.iv.next139.i, %for.cond.loopexit.us.i ]
%indvars.iv131.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next132.i, %for.cond.loopexit.us.i ]
%sw.0118.us.i = phi i32 [ 1, %for.body.us.preheader.i ], [ %sw.1.lcssa.us.i, %for.cond.loopexit.us.i ]
%indvars.iv.next139.i = add nuw nsw i64 %indvars.iv138.i, 1
%cmp2100.us.i = icmp ult i64 %indvars.iv.next139.i, %12
br i1 %cmp2100.us.i, label %for.cond5.preheader.lr.ph.us.i, label %for.cond.loopexit.us.i
for.cond.loopexit.us.i: ; preds = %for.cond5.for.cond.cleanup7_crit_edge.us.us.i, %for.body.us.i
%sw.1.lcssa.us.i = phi i32 [ %sw.0118.us.i, %for.body.us.i ], [ %sw.3.lcssa.us.us.i, %for.cond5.for.cond.cleanup7_crit_edge.us.us.i ]
%indvars.iv.next132.i = add nuw nsw i64 %indvars.iv131.i, 1
%exitcond142.not.i = icmp eq i64 %indvars.iv.next139.i, %12
br i1 %exitcond142.not.i, label %for.cond.cleanup.i, label %for.body.us.i, !llvm.loop !5
for.cond5.preheader.lr.ph.us.i: ; preds = %for.body.us.i
%arrayidx.us.i = getelementptr inbounds %struct._card, ptr %c, i64 %indvars.iv138.i
%value.us.i = getelementptr inbounds %struct._card, ptr %c, i64 %indvars.iv138.i, i32 1
br label %for.cond5.preheader.us.us.i
for.cond5.preheader.us.us.i: ; preds = %for.cond5.for.cond.cleanup7_crit_edge.us.us.i, %for.cond5.preheader.lr.ph.us.i
%indvars.iv133.i = phi i64 [ %indvars.iv.next134.i, %for.cond5.for.cond.cleanup7_crit_edge.us.us.i ], [ %indvars.iv131.i, %for.cond5.preheader.lr.ph.us.i ]
%sw.1101.us.us.i = phi i32 [ %sw.3.lcssa.us.us.i, %for.cond5.for.cond.cleanup7_crit_edge.us.us.i ], [ %sw.0118.us.i, %for.cond5.preheader.lr.ph.us.i ]
%arrayidx15.us.us.i = getelementptr inbounds %struct._card, ptr %c, i64 %indvars.iv133.i
%value16.us.us.i = getelementptr inbounds %struct._card, ptr %c, i64 %indvars.iv133.i, i32 1
br label %for.body8.us.us.i
for.body8.us.us.i: ; preds = %for.cond5.loopexit.us.us.i, %for.cond5.preheader.us.us.i
%indvars.iv126.i = phi i64 [ %indvars.iv.next127.i, %for.cond5.loopexit.us.us.i ], [ 0, %for.cond5.preheader.us.us.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.cond5.loopexit.us.us.i ], [ 1, %for.cond5.preheader.us.us.i ]
%sw.298.us.us.i = phi i32 [ %sw.3.lcssa.us.us.i, %for.cond5.loopexit.us.us.i ], [ %sw.1101.us.us.i, %for.cond5.preheader.us.us.i ]
%indvars.iv.next127.i = add nuw nsw i64 %indvars.iv126.i, 1
%cmp1193.us.us.i = icmp ult i64 %indvars.iv.next127.i, %12
br i1 %cmp1193.us.us.i, label %for.body13.lr.ph.us.us.i, label %for.cond5.loopexit.us.us.i
for.cond5.loopexit.us.us.i: ; preds = %for.inc.us.us.us.us.i, %for.body13.lr.ph.split.us.us.us.i, %for.body13.lr.ph.us.us.i, %for.body8.us.us.i
%sw.3.lcssa.us.us.i = phi i32 [ %sw.298.us.us.i, %for.body8.us.us.i ], [ %sw.298.us.us.i, %for.body13.lr.ph.us.us.i ], [ %sw.298.us.us.i, %for.body13.lr.ph.split.us.us.us.i ], [ %sw.4.us.us.us.us.i, %for.inc.us.us.us.us.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond130.not.i = icmp eq i64 %indvars.iv.next127.i, %12
br i1 %exitcond130.not.i, label %for.cond5.for.cond.cleanup7_crit_edge.us.us.i, label %for.body8.us.us.i, !llvm.loop !7
for.body13.lr.ph.us.us.i: ; preds = %for.body8.us.us.i
%13 = load i32, ptr %value.us.i, align 4, !tbaa !8
%14 = load i32, ptr %value16.us.us.i, align 4, !tbaa !8
%cmp17.us.us.i = icmp eq i32 %13, %14
%arrayidx22.us.us.i = getelementptr inbounds %struct._card, ptr %babblec, i64 %indvars.iv126.i
br i1 %cmp17.us.us.i, label %for.body13.lr.ph.split.us.us.us.i, label %for.cond5.loopexit.us.us.i
for.body13.lr.ph.split.us.us.us.i: ; preds = %for.body13.lr.ph.us.us.i
%value23.us.us.i = getelementptr inbounds %struct._card, ptr %babblec, i64 %indvars.iv126.i, i32 1
%15 = load i32, ptr %value23.us.us.i, align 4, !tbaa !8
%cmp24.us.us.us.i = icmp eq i32 %13, %15
br i1 %cmp24.us.us.us.i, label %for.body13.us.us.us.us.i, label %for.cond5.loopexit.us.us.i
for.body13.us.us.us.us.i: ; preds = %for.body13.lr.ph.split.us.us.us.i, %for.inc.us.us.us.us.i
%indvars.iv123.i = phi i64 [ %indvars.iv.next124.i, %for.inc.us.us.us.us.i ], [ %indvars.iv.i, %for.body13.lr.ph.split.us.us.us.i ]
%sw.394.us.us.us.us.i = phi i32 [ %sw.4.us.us.us.us.i, %for.inc.us.us.us.us.i ], [ %sw.298.us.us.i, %for.body13.lr.ph.split.us.us.us.i ]
%value31.us.us.us.us.i = getelementptr inbounds %struct._card, ptr %babblec, i64 %indvars.iv123.i, i32 1
%16 = load i32, ptr %value31.us.us.us.us.i, align 4, !tbaa !8
%cmp32.us.us.us.us.i = icmp eq i32 %13, %16
br i1 %cmp32.us.us.us.us.i, label %land.lhs.true33.us.us.us.us.i, label %for.inc.us.us.us.us.i
land.lhs.true33.us.us.us.us.i: ; preds = %for.body13.us.us.us.us.i
%arrayidx30.us.us.us.us.i = getelementptr inbounds %struct._card, ptr %babblec, i64 %indvars.iv123.i
%17 = load i8, ptr %arrayidx.us.i, align 4, !tbaa !13
%18 = load i8, ptr %arrayidx30.us.us.us.us.i, align 8, !tbaa !13
%cmp40.us.us.us.us.i = icmp eq i8 %17, %18
br i1 %cmp40.us.us.us.us.i, label %land.lhs.true42.us.us.us.us.i, label %for.inc.us.us.us.us.i
land.lhs.true42.us.us.us.us.i: ; preds = %land.lhs.true33.us.us.us.us.i
%19 = load i8, ptr %arrayidx15.us.us.i, align 4, !tbaa !13
%20 = load i8, ptr %arrayidx22.us.us.i, align 8, !tbaa !13
%cmp51.us.us.us.us.i = icmp eq i8 %19, %20
%spec.select.us.us.us.us.i = select i1 %cmp51.us.us.us.us.i, i32 0, i32 %sw.394.us.us.us.us.i
br label %for.inc.us.us.us.us.i
for.inc.us.us.us.us.i: ; preds = %land.lhs.true42.us.us.us.us.i, %land.lhs.true33.us.us.us.us.i, %for.body13.us.us.us.us.i
%sw.4.us.us.us.us.i = phi i32 [ %sw.394.us.us.us.us.i, %land.lhs.true33.us.us.us.us.i ], [ %sw.394.us.us.us.us.i, %for.body13.us.us.us.us.i ], [ %spec.select.us.us.us.us.i, %land.lhs.true42.us.us.us.us.i ]
%indvars.iv.next124.i = add nuw nsw i64 %indvars.iv123.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next124.i, %12
br i1 %exitcond.not.i, label %for.cond5.loopexit.us.us.i, label %for.body13.us.us.us.us.i, !llvm.loop !14
for.cond5.for.cond.cleanup7_crit_edge.us.us.i: ; preds = %for.cond5.loopexit.us.us.i
%indvars.iv.next134.i = add nuw nsw i64 %indvars.iv133.i, 1
%exitcond137.not.i = icmp eq i64 %indvars.iv.next134.i, %12
br i1 %exitcond137.not.i, label %for.cond.loopexit.us.i, label %for.cond5.preheader.us.us.i, !llvm.loop !15
for.cond.cleanup.i: ; preds = %for.cond.loopexit.us.i
%21 = icmp eq i32 %sw.1.lcssa.us.i, 0
%spec.select.i = select i1 %21, ptr @str, ptr @str.5
br label %isstable.exit
isstable.exit: ; preds = %entry, %for.cond35.preheader, %for.cond.cleanup37, %for.cond.cleanup.i
%str.sink.i = phi ptr [ @str.5, %for.cond.cleanup37 ], [ %spec.select.i, %for.cond.cleanup.i ], [ @str.5, %for.cond35.preheader ], [ @str.5, %entry ]
%puts.i = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink.i)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %babblec) #5
ret void
if.end40: ; preds = %if.end40.peel, %if.end40
%indvars.iv91 = phi i64 [ %indvars.iv.next92, %if.end40 ], [ 1, %if.end40.peel ]
%putchar = tail call i32 @putchar(i32 32)
%arrayidx42 = getelementptr inbounds [36 x %struct._card], ptr %babblec, i64 0, i64 %indvars.iv91
%22 = load i8, ptr %arrayidx42, align 8, !tbaa !13
%conv = sext i8 %22 to i32
%value45 = getelementptr inbounds [36 x %struct._card], ptr %babblec, i64 0, i64 %indvars.iv91, i32 1
%23 = load i32, ptr %value45, align 4, !tbaa !8
%call46 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv, i32 noundef %23)
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%exitcond95.not = icmp eq i64 %indvars.iv.next92, %wide.trip.count94
br i1 %exitcond95.not, label %for.cond.cleanup37, label %if.end40, !llvm.loop !18
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @selectsort(ptr nocapture noundef readonly %c, i32 noundef %N) local_unnamed_addr #0 {
entry:
%selectc = alloca [36 x %struct._card], align 16
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %selectc) #5
%cmp70 = icmp sgt i32 %N, 0
br i1 %cmp70, label %for.body7.preheader, label %isstable.exit
for.body7.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%1 = shl nuw nsw i64 %0, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %selectc, ptr align 4 %c, i64 %1, i1 false)
%2 = zext i32 %N to i64
%wide.trip.count86 = zext i32 %N to i64
br label %for.body7
for.cond33.preheader: ; preds = %for.cond.cleanup10
br i1 %cmp70, label %if.end38.peel, label %isstable.exit
if.end38.peel: ; preds = %for.cond33.preheader
%wide.trip.count91 = zext i32 %N to i64
%3 = load i8, ptr %selectc, align 16, !tbaa !13
%conv.peel = sext i8 %3 to i32
%value43.peel = getelementptr inbounds [36 x %struct._card], ptr %selectc, i64 0, i64 0, i32 1
%4 = load i32, ptr %value43.peel, align 4, !tbaa !8
%call44.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.peel, i32 noundef %4)
%exitcond92.peel.not = icmp eq i32 %N, 1
br i1 %exitcond92.peel.not, label %for.body.us.preheader.i, label %if.end38
for.body7: ; preds = %for.body7.preheader, %for.cond.cleanup10
%indvars.iv83 = phi i64 [ 0, %for.body7.preheader ], [ %indvars.iv.next84, %for.cond.cleanup10 ]
%indvars.iv = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next, %for.cond.cleanup10 ]
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%cmp972 = icmp ult i64 %indvars.iv.next84, %2
%5 = trunc i64 %indvars.iv83 to i32
br i1 %cmp972, label %for.body11, label %for.cond.cleanup10
for.cond.cleanup10: ; preds = %for.body11, %for.body7
%minj.0.lcssa = phi i32 [ %5, %for.body7 ], [ %spec.select, %for.body11 ]
%arrayidx22 = getelementptr inbounds [36 x %struct._card], ptr %selectc, i64 0, i64 %indvars.iv83
%6 = load i64, ptr %arrayidx22, align 8
%idxprom25 = sext i32 %minj.0.lcssa to i64
%arrayidx26 = getelementptr inbounds [36 x %struct._card], ptr %selectc, i64 0, i64 %idxprom25
%7 = load i64, ptr %arrayidx26, align 8
store i64 %7, ptr %arrayidx22, align 8
store i64 %6, ptr %arrayidx26, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
br i1 %exitcond87.not, label %for.cond33.preheader, label %for.body7, !llvm.loop !20
for.body11: ; preds = %for.body7, %for.body11
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.body11 ], [ %indvars.iv, %for.body7 ]
%minj.073 = phi i32 [ %spec.select, %for.body11 ], [ %5, %for.body7 ]
%idxprom12 = sext i32 %minj.073 to i64
%value = getelementptr inbounds [36 x %struct._card], ptr %selectc, i64 0, i64 %idxprom12, i32 1
%8 = load i32, ptr %value, align 4, !tbaa !8
%value16 = getelementptr inbounds [36 x %struct._card], ptr %selectc, i64 0, i64 %indvars.iv80, i32 1
%9 = load i32, ptr %value16, align 4, !tbaa !8
%cmp17 = icmp sgt i32 %8, %9
%10 = trunc i64 %indvars.iv80 to i32
%spec.select = select i1 %cmp17, i32 %10, i32 %minj.073
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%exitcond.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count86
br i1 %exitcond.not, label %for.cond.cleanup10, label %for.body11, !llvm.loop !21
for.cond.cleanup35: ; preds = %if.end38
br i1 %cmp70, label %for.body.us.preheader.i, label %isstable.exit
for.body.us.preheader.i: ; preds = %if.end38.peel, %for.cond.cleanup35
%11 = zext i32 %N to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv138.i = phi i64 [ 0, %for.body.us.preheader.i ], [ %indvars.iv.next139.i, %for.cond.loopexit.us.i ]
%indvars.iv131.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next132.i, %for.cond.loopexit.us.i ]
%sw.0118.us.i = phi i32 [ 1, %for.body.us.preheader.i ], [ %sw.1.lcssa.us.i, %for.cond.loopexit.us.i ]
%indvars.iv.next139.i = add nuw nsw i64 %indvars.iv138.i, 1
%cmp2100.us.i = icmp ult i64 %indvars.iv.next139.i, %11
br i1 %cmp2100.us.i, label %for.cond5.preheader.lr.ph.us.i, label %for.cond.loopexit.us.i
for.cond.loopexit.us.i: ; preds = %for.cond5.for.cond.cleanup7_crit_edge.us.us.i, %for.body.us.i
%sw.1.lcssa.us.i = phi i32 [ %sw.0118.us.i, %for.body.us.i ], [ %sw.3.lcssa.us.us.i, %for.cond5.for.cond.cleanup7_crit_edge.us.us.i ]
%indvars.iv.next132.i = add nuw nsw i64 %indvars.iv131.i, 1
%exitcond142.not.i = icmp eq i64 %indvars.iv.next139.i, %11
br i1 %exitcond142.not.i, label %for.cond.cleanup.i, label %for.body.us.i, !llvm.loop !5
for.cond5.preheader.lr.ph.us.i: ; preds = %for.body.us.i
%arrayidx.us.i = getelementptr inbounds %struct._card, ptr %c, i64 %indvars.iv138.i
%value.us.i = getelementptr inbounds %struct._card, ptr %c, i64 %indvars.iv138.i, i32 1
br label %for.cond5.preheader.us.us.i
for.cond5.preheader.us.us.i: ; preds = %for.cond5.for.cond.cleanup7_crit_edge.us.us.i, %for.cond5.preheader.lr.ph.us.i
%indvars.iv133.i = phi i64 [ %indvars.iv.next134.i, %for.cond5.for.cond.cleanup7_crit_edge.us.us.i ], [ %indvars.iv131.i, %for.cond5.preheader.lr.ph.us.i ]
%sw.1101.us.us.i = phi i32 [ %sw.3.lcssa.us.us.i, %for.cond5.for.cond.cleanup7_crit_edge.us.us.i ], [ %sw.0118.us.i, %for.cond5.preheader.lr.ph.us.i ]
%arrayidx15.us.us.i = getelementptr inbounds %struct._card, ptr %c, i64 %indvars.iv133.i
%value16.us.us.i = getelementptr inbounds %struct._card, ptr %c, i64 %indvars.iv133.i, i32 1
br label %for.body8.us.us.i
for.body8.us.us.i: ; preds = %for.cond5.loopexit.us.us.i, %for.cond5.preheader.us.us.i
%indvars.iv126.i = phi i64 [ %indvars.iv.next127.i, %for.cond5.loopexit.us.us.i ], [ 0, %for.cond5.preheader.us.us.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.cond5.loopexit.us.us.i ], [ 1, %for.cond5.preheader.us.us.i ]
%sw.298.us.us.i = phi i32 [ %sw.3.lcssa.us.us.i, %for.cond5.loopexit.us.us.i ], [ %sw.1101.us.us.i, %for.cond5.preheader.us.us.i ]
%indvars.iv.next127.i = add nuw nsw i64 %indvars.iv126.i, 1
%cmp1193.us.us.i = icmp ult i64 %indvars.iv.next127.i, %11
br i1 %cmp1193.us.us.i, label %for.body13.lr.ph.us.us.i, label %for.cond5.loopexit.us.us.i
for.cond5.loopexit.us.us.i: ; preds = %for.inc.us.us.us.us.i, %for.body13.lr.ph.split.us.us.us.i, %for.body13.lr.ph.us.us.i, %for.body8.us.us.i
%sw.3.lcssa.us.us.i = phi i32 [ %sw.298.us.us.i, %for.body8.us.us.i ], [ %sw.298.us.us.i, %for.body13.lr.ph.us.us.i ], [ %sw.298.us.us.i, %for.body13.lr.ph.split.us.us.us.i ], [ %sw.4.us.us.us.us.i, %for.inc.us.us.us.us.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond130.not.i = icmp eq i64 %indvars.iv.next127.i, %11
br i1 %exitcond130.not.i, label %for.cond5.for.cond.cleanup7_crit_edge.us.us.i, label %for.body8.us.us.i, !llvm.loop !7
for.body13.lr.ph.us.us.i: ; preds = %for.body8.us.us.i
%12 = load i32, ptr %value.us.i, align 4, !tbaa !8
%13 = load i32, ptr %value16.us.us.i, align 4, !tbaa !8
%cmp17.us.us.i = icmp eq i32 %12, %13
%arrayidx22.us.us.i = getelementptr inbounds %struct._card, ptr %selectc, i64 %indvars.iv126.i
br i1 %cmp17.us.us.i, label %for.body13.lr.ph.split.us.us.us.i, label %for.cond5.loopexit.us.us.i
for.body13.lr.ph.split.us.us.us.i: ; preds = %for.body13.lr.ph.us.us.i
%value23.us.us.i = getelementptr inbounds %struct._card, ptr %selectc, i64 %indvars.iv126.i, i32 1
%14 = load i32, ptr %value23.us.us.i, align 4, !tbaa !8
%cmp24.us.us.us.i = icmp eq i32 %12, %14
br i1 %cmp24.us.us.us.i, label %for.body13.us.us.us.us.i, label %for.cond5.loopexit.us.us.i
for.body13.us.us.us.us.i: ; preds = %for.body13.lr.ph.split.us.us.us.i, %for.inc.us.us.us.us.i
%indvars.iv123.i = phi i64 [ %indvars.iv.next124.i, %for.inc.us.us.us.us.i ], [ %indvars.iv.i, %for.body13.lr.ph.split.us.us.us.i ]
%sw.394.us.us.us.us.i = phi i32 [ %sw.4.us.us.us.us.i, %for.inc.us.us.us.us.i ], [ %sw.298.us.us.i, %for.body13.lr.ph.split.us.us.us.i ]
%value31.us.us.us.us.i = getelementptr inbounds %struct._card, ptr %selectc, i64 %indvars.iv123.i, i32 1
%15 = load i32, ptr %value31.us.us.us.us.i, align 4, !tbaa !8
%cmp32.us.us.us.us.i = icmp eq i32 %12, %15
br i1 %cmp32.us.us.us.us.i, label %land.lhs.true33.us.us.us.us.i, label %for.inc.us.us.us.us.i
land.lhs.true33.us.us.us.us.i: ; preds = %for.body13.us.us.us.us.i
%arrayidx30.us.us.us.us.i = getelementptr inbounds %struct._card, ptr %selectc, i64 %indvars.iv123.i
%16 = load i8, ptr %arrayidx.us.i, align 4, !tbaa !13
%17 = load i8, ptr %arrayidx30.us.us.us.us.i, align 8, !tbaa !13
%cmp40.us.us.us.us.i = icmp eq i8 %16, %17
br i1 %cmp40.us.us.us.us.i, label %land.lhs.true42.us.us.us.us.i, label %for.inc.us.us.us.us.i
land.lhs.true42.us.us.us.us.i: ; preds = %land.lhs.true33.us.us.us.us.i
%18 = load i8, ptr %arrayidx15.us.us.i, align 4, !tbaa !13
%19 = load i8, ptr %arrayidx22.us.us.i, align 8, !tbaa !13
%cmp51.us.us.us.us.i = icmp eq i8 %18, %19
%spec.select.us.us.us.us.i = select i1 %cmp51.us.us.us.us.i, i32 0, i32 %sw.394.us.us.us.us.i
br label %for.inc.us.us.us.us.i
for.inc.us.us.us.us.i: ; preds = %land.lhs.true42.us.us.us.us.i, %land.lhs.true33.us.us.us.us.i, %for.body13.us.us.us.us.i
%sw.4.us.us.us.us.i = phi i32 [ %sw.394.us.us.us.us.i, %land.lhs.true33.us.us.us.us.i ], [ %sw.394.us.us.us.us.i, %for.body13.us.us.us.us.i ], [ %spec.select.us.us.us.us.i, %land.lhs.true42.us.us.us.us.i ]
%indvars.iv.next124.i = add nuw nsw i64 %indvars.iv123.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next124.i, %11
br i1 %exitcond.not.i, label %for.cond5.loopexit.us.us.i, label %for.body13.us.us.us.us.i, !llvm.loop !14
for.cond5.for.cond.cleanup7_crit_edge.us.us.i: ; preds = %for.cond5.loopexit.us.us.i
%indvars.iv.next134.i = add nuw nsw i64 %indvars.iv133.i, 1
%exitcond137.not.i = icmp eq i64 %indvars.iv.next134.i, %11
br i1 %exitcond137.not.i, label %for.cond.loopexit.us.i, label %for.cond5.preheader.us.us.i, !llvm.loop !15
for.cond.cleanup.i: ; preds = %for.cond.loopexit.us.i
%20 = icmp eq i32 %sw.1.lcssa.us.i, 0
%spec.select.i = select i1 %20, ptr @str, ptr @str.5
br label %isstable.exit
isstable.exit: ; preds = %entry, %for.cond33.preheader, %for.cond.cleanup35, %for.cond.cleanup.i
%str.sink.i = phi ptr [ @str.5, %for.cond.cleanup35 ], [ %spec.select.i, %for.cond.cleanup.i ], [ @str.5, %for.cond33.preheader ], [ @str.5, %entry ]
%puts.i = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink.i)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %selectc) #5
ret void
if.end38: ; preds = %if.end38.peel, %if.end38
%indvars.iv88 = phi i64 [ %indvars.iv.next89, %if.end38 ], [ 1, %if.end38.peel ]
%putchar = tail call i32 @putchar(i32 32)
%arrayidx40 = getelementptr inbounds [36 x %struct._card], ptr %selectc, i64 0, i64 %indvars.iv88
%21 = load i8, ptr %arrayidx40, align 8, !tbaa !13
%conv = sext i8 %21 to i32
%value43 = getelementptr inbounds [36 x %struct._card], ptr %selectc, i64 0, i64 %indvars.iv88, i32 1
%22 = load i32, ptr %value43, align 4, !tbaa !8
%call44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv, i32 noundef %22)
%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.cond.cleanup35, label %if.end38, !llvm.loop !22
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%c = alloca [36 x %struct._card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !23
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %if.end.peel, label %for.cond.cleanup
if.end.peel: ; preds = %entry
%value.peel = getelementptr inbounds [36 x %struct._card], ptr %c, i64 0, i64 0, i32 1
%call4.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %c, ptr noundef nonnull %value.peel)
%1 = load i32, ptr %N, align 4, !tbaa !23
%cmp.peel = icmp sgt i32 %1, 1
br i1 %cmp.peel, label %if.end, label %for.cond.cleanup
for.cond.cleanup: ; preds = %if.end, %if.end.peel, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %if.end.peel ], [ %3, %if.end ]
call void @babblesort(ptr noundef nonnull %c, i32 noundef %.lcssa)
%2 = load i32, ptr %N, align 4, !tbaa !23
call void @selectsort(ptr noundef nonnull %c, i32 noundef %2)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2)
%arrayidx = getelementptr inbounds [36 x %struct._card], ptr %c, i64 0, i64 %indvars.iv
%value = getelementptr inbounds [36 x %struct._card], ptr %c, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arrayidx, ptr noundef nonnull %value)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !23
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %if.end, label %for.cond.cleanup, !llvm.loop !24
}
; 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 #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !12, i64 4}
!9 = !{!"_card", !10, i64 0, !12, i64 4}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!9, !10, i64 0}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6, !19}
!19 = !{!"llvm.loop.peeled.count", i32 1}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6, !19}
!23 = !{!12, !12, i64 0}
!24 = distinct !{!24, !6, !19}
|
#include<stdio.h>
#include<string.h>
typedef struct{
char mark;
int num;
}card;
void Bubblesort(card*);
void Selectionsort(card*);
void isStable(card*);
int n;
card C[36];
int main(){
card B[36],S[36];
int i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf(" %c%d",&C[i].mark,&C[i].num);
}
for(i=0;i<n;i++){
strncpy(&B[i].mark,&C[i].mark,1);
strncpy(&S[i].mark,&C[i].mark,1);
B[i].num=C[i].num;
S[i].num=C[i].num;
}
Bubblesort(B);
Selectionsort(S);
return 0;
}
void Bubblesort(card *C){
int i,j,num;
char mark;
card chg;
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(C[j].num<C[j-1].num){
chg = C[j];
C[j] = C[j-1];
C[j-1] = chg;
}
}
}
for(i=0;i<n;i++){
if(i!=0)printf(" ");
printf("%c%d",C[i].mark,C[i].num);
}
printf("\n");
isStable(C);
}
void Selectionsort(card *C){
int i,j,minj;
card chg;
for(i=0;i<n-1;i++){
minj=i;
for(j=i;j<n;j++){
if(C[j].num<C[minj].num){
minj=j;
}}
chg = C[i];
C[i] = C[minj];
C[minj] = chg;
}
for(i=0;i<n;i++){
if(i!=0)printf(" ");
printf("%c%d",C[i].mark,C[i].num);
}
printf("\n");
isStable(C);
}
void isStable(card out[]){
int i,j,a,b,flag=0;
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
for(a=0;a<n;a++){
for(b=a+1;b<n;b++){
if(C[i].num==C[j].num&&C[i].mark==out[b].mark&&C[i].num==out[b].num&&C[j].num==out[a].num&&C[j].mark==out[a].mark){
flag=1;
}
}
}
}
}
if(flag==0){
printf("Stable\n");
}else{
printf("Not stable\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114094/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114094/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.card = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@C = dso_local global [36 x %struct.card] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@str = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%B = alloca [36 x %struct.card], align 16
%S = alloca [36 x %struct.card], align 16
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %S) #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
%cmp51 = icmp sgt i32 %0, 0
br i1 %cmp51, label %for.body, label %for.end35
for.cond4.preheader: ; preds = %for.body
%cmp553 = icmp sgt i32 %2, 0
br i1 %cmp553, label %for.body6.preheader, label %for.end35
for.body6.preheader: ; preds = %for.cond4.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %2, 1
br i1 %1, label %for.end35.loopexit.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv
%num = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv, i32 1
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %num)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr @n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv57 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next58.1, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ]
%arrayidx8 = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv57
%arrayidx11 = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv57
%stxncpy.char0 = load i8, ptr %arrayidx11, align 16
store i8 %stxncpy.char0, ptr %arrayidx8, align 16
%arrayidx15 = getelementptr inbounds [36 x %struct.card], ptr %S, i64 0, i64 %indvars.iv57
store i8 %stxncpy.char0, ptr %arrayidx15, align 16
%num23 = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv57, i32 1
%4 = load i32, ptr %num23, align 4, !tbaa !11
%num26 = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv57, i32 1
store i32 %4, ptr %num26, align 4, !tbaa !11
%num32 = getelementptr inbounds [36 x %struct.card], ptr %S, i64 0, i64 %indvars.iv57, i32 1
store i32 %4, ptr %num32, align 4, !tbaa !11
%indvars.iv.next58 = or i64 %indvars.iv57, 1
%arrayidx8.1 = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv.next58
%arrayidx11.1 = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv.next58
%stxncpy.char0.1 = load i8, ptr %arrayidx11.1, align 8
store i8 %stxncpy.char0.1, ptr %arrayidx8.1, align 8
%arrayidx15.1 = getelementptr inbounds [36 x %struct.card], ptr %S, i64 0, i64 %indvars.iv.next58
store i8 %stxncpy.char0.1, ptr %arrayidx15.1, align 8
%num23.1 = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv.next58, i32 1
%5 = load i32, ptr %num23.1, align 4, !tbaa !11
%num26.1 = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv.next58, i32 1
store i32 %5, ptr %num26.1, align 4, !tbaa !11
%num32.1 = getelementptr inbounds [36 x %struct.card], ptr %S, i64 0, i64 %indvars.iv.next58, i32 1
store i32 %5, ptr %num32.1, align 4, !tbaa !11
%indvars.iv.next58.1 = add nuw nsw i64 %indvars.iv57, 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.end35.loopexit.unr-lcssa, label %for.body6, !llvm.loop !13
for.end35.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%indvars.iv57.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next58.1, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end35, label %for.body6.epil
for.body6.epil: ; preds = %for.end35.loopexit.unr-lcssa
%arrayidx8.epil = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv57.unr
%arrayidx11.epil = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv57.unr
%stxncpy.char0.epil = load i8, ptr %arrayidx11.epil, align 8
store i8 %stxncpy.char0.epil, ptr %arrayidx8.epil, align 8
%arrayidx15.epil = getelementptr inbounds [36 x %struct.card], ptr %S, i64 0, i64 %indvars.iv57.unr
store i8 %stxncpy.char0.epil, ptr %arrayidx15.epil, align 8
%num23.epil = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv57.unr, i32 1
%6 = load i32, ptr %num23.epil, align 4, !tbaa !11
%num26.epil = getelementptr inbounds [36 x %struct.card], ptr %B, i64 0, i64 %indvars.iv57.unr, i32 1
store i32 %6, ptr %num26.epil, align 4, !tbaa !11
%num32.epil = getelementptr inbounds [36 x %struct.card], ptr %S, i64 0, i64 %indvars.iv57.unr, i32 1
store i32 %6, ptr %num32.epil, align 4, !tbaa !11
br label %for.end35
for.end35: ; preds = %for.body6.epil, %for.end35.loopexit.unr-lcssa, %entry, %for.cond4.preheader
call void @Bubblesort(ptr noundef nonnull %B)
call void @Selectionsort(ptr noundef nonnull %S)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %S) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %B) #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 @Bubblesort(ptr nocapture noundef %C) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, label %for.cond1.preheader.lr.ph, label %for.end37
for.cond1.preheader.lr.ph: ; preds = %entry
%j.062 = add nsw i32 %0, -1
%1 = zext i32 %0 to i64
%2 = add nsw i64 %1, -1
%3 = zext i32 %j.062 to i64
%wide.trip.count = zext i32 %0 to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc20
%indvars.iv76 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next77, %for.inc20 ]
%cmp263 = icmp ult i64 %indvars.iv76, %3
br i1 %cmp263, label %for.body3, label %for.inc20
for.cond22.preheader: ; preds = %for.inc20
br i1 %cmp66, label %if.end27.peel, label %for.end37
if.end27.peel: ; preds = %for.cond22.preheader
%num33.peel.phi.trans.insert = getelementptr inbounds %struct.card, ptr %C, i64 0, i32 1
%.pre83 = load i32, ptr %num33.peel.phi.trans.insert, align 4, !tbaa !11
%.pre = load i8, ptr %C, align 4, !tbaa !14
%conv.peel = sext i8 %.pre to i32
%call34.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.peel, i32 noundef %.pre83)
%4 = load i32, ptr @n, align 4, !tbaa !5
%cmp23.peel = icmp sgt i32 %4, 1
br i1 %cmp23.peel, label %if.end27, label %for.end37
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv70 = phi i64 [ %indvars.iv.next71, %for.inc ], [ %1, %for.cond1.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %2, %for.cond1.preheader ]
%indvars.iv.next71 = add nsw i64 %indvars.iv70, -1
%num4 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv, i32 1
%5 = load i32, ptr %num4, align 4, !tbaa !11
%6 = add nsw i64 %indvars.iv70, -2
%num8 = getelementptr inbounds %struct.card, ptr %C, i64 %6, i32 1
%7 = load i32, ptr %num8, align 4, !tbaa !11
%cmp9 = icmp slt i32 %5, %7
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx7 = getelementptr inbounds %struct.card, ptr %C, i64 %6
%arrayidx = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv
%8 = load i64, ptr %arrayidx, align 4
%9 = load i64, ptr %arrayidx7, align 4
store i64 %9, ptr %arrayidx, align 4
store i64 %8, ptr %arrayidx7, align 4
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp2 = icmp sgt i64 %indvars.iv.next, %indvars.iv76
br i1 %cmp2, label %for.body3, label %for.inc20, !llvm.loop !15
for.inc20: ; preds = %for.inc, %for.cond1.preheader
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%exitcond.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count
br i1 %exitcond.not, label %for.cond22.preheader, label %for.cond1.preheader, !llvm.loop !16
if.end27: ; preds = %if.end27.peel, %if.end27
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %if.end27 ], [ 1, %if.end27.peel ]
%putchar61 = tail call i32 @putchar(i32 32)
%arrayidx29 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv79
%10 = load i8, ptr %arrayidx29, align 4, !tbaa !14
%conv = sext i8 %10 to i32
%num33 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv79, i32 1
%11 = load i32, ptr %num33, align 4, !tbaa !11
%call34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv, i32 noundef %11)
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%12 = load i32, ptr @n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp23 = icmp slt i64 %indvars.iv.next80, %13
br i1 %cmp23, label %if.end27, label %for.end37, !llvm.loop !17
for.end37: ; preds = %if.end27, %entry, %if.end27.peel, %for.cond22.preheader
%putchar = tail call i32 @putchar(i32 10)
%14 = load i32, ptr @n, align 4, !tbaa !5
%cmp105.i = icmp sgt i32 %14, 0
br i1 %cmp105.i, label %for.body.us.preheader.i, label %isStable.exit
for.body.us.preheader.i: ; preds = %for.end37
%15 = zext i32 %14 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv125.i = phi i64 [ 0, %for.body.us.preheader.i ], [ %indvars.iv.next126.i, %for.cond.loopexit.us.i ]
%indvars.iv118.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next119.i, %for.cond.loopexit.us.i ]
%flag.0107.us.i = phi i32 [ 0, %for.body.us.preheader.i ], [ %flag.1.lcssa.us.i, %for.cond.loopexit.us.i ]
%indvars.iv.next126.i = add nuw nsw i64 %indvars.iv125.i, 1
%cmp293.us.i = icmp ult i64 %indvars.iv.next126.i, %15
br i1 %cmp293.us.i, label %for.cond4.preheader.lr.ph.us.i, label %for.cond.loopexit.us.i
for.cond.loopexit.us.i: ; preds = %for.cond4.for.inc55_crit_edge.us.us.i, %for.body.us.i
%flag.1.lcssa.us.i = phi i32 [ %flag.0107.us.i, %for.body.us.i ], [ %flag.3.lcssa.us.us.i, %for.cond4.for.inc55_crit_edge.us.us.i ]
%indvars.iv.next119.i = add nuw nsw i64 %indvars.iv118.i, 1
%exitcond129.not.i = icmp eq i64 %indvars.iv.next126.i, %15
br i1 %exitcond129.not.i, label %for.end60.i, label %for.body.us.i, !llvm.loop !19
for.cond4.preheader.lr.ph.us.i: ; preds = %for.body.us.i
%num.us.i = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv125.i, i32 1
%arrayidx.us.i = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv125.i
br label %for.cond4.preheader.us.us.i
for.cond4.preheader.us.us.i: ; preds = %for.cond4.for.inc55_crit_edge.us.us.i, %for.cond4.preheader.lr.ph.us.i
%indvars.iv120.i = phi i64 [ %indvars.iv.next121.i, %for.cond4.for.inc55_crit_edge.us.us.i ], [ %indvars.iv118.i, %for.cond4.preheader.lr.ph.us.i ]
%flag.195.us.us.i = phi i32 [ %flag.3.lcssa.us.us.i, %for.cond4.for.inc55_crit_edge.us.us.i ], [ %flag.0107.us.i, %for.cond4.preheader.lr.ph.us.i ]
%arrayidx12.us.us.i = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv120.i
%num13.us.us.i = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv120.i, i32 1
br label %for.body6.us.us.i
for.body6.us.us.i: ; preds = %for.cond4.loopexit.us.us.i, %for.cond4.preheader.us.us.i
%indvars.iv113.i = phi i64 [ %indvars.iv.next114.i, %for.cond4.loopexit.us.us.i ], [ 0, %for.cond4.preheader.us.us.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.cond4.loopexit.us.us.i ], [ 1, %for.cond4.preheader.us.us.i ]
%flag.292.us.us.i = phi i32 [ %flag.3.lcssa.us.us.i, %for.cond4.loopexit.us.us.i ], [ %flag.195.us.us.i, %for.cond4.preheader.us.us.i ]
%indvars.iv.next114.i = add nuw nsw i64 %indvars.iv113.i, 1
%cmp987.us.us.i = icmp ult i64 %indvars.iv.next114.i, %15
br i1 %cmp987.us.us.i, label %for.body10.lr.ph.us.us.i, label %for.cond4.loopexit.us.us.i
for.cond4.loopexit.us.us.i: ; preds = %for.inc.us.us.us.i, %for.body10.lr.ph.us.us.i, %for.body6.us.us.i
%flag.3.lcssa.us.us.i = phi i32 [ %flag.292.us.us.i, %for.body6.us.us.i ], [ %flag.292.us.us.i, %for.body10.lr.ph.us.us.i ], [ %flag.4.us.us.us.i, %for.inc.us.us.us.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond117.not.i = icmp eq i64 %indvars.iv.next114.i, %15
br i1 %exitcond117.not.i, label %for.cond4.for.inc55_crit_edge.us.us.i, label %for.body6.us.us.i, !llvm.loop !20
for.body10.lr.ph.us.us.i: ; preds = %for.body6.us.us.i
%16 = load i32, ptr %num.us.i, align 4, !tbaa !11
%17 = load i32, ptr %num13.us.us.i, align 4, !tbaa !11
%cmp14.us.us.i = icmp eq i32 %16, %17
%num38.us.us.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv113.i, i32 1
%arrayidx37.us.us.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv113.i
br i1 %cmp14.us.us.i, label %for.body10.lr.ph.split.us.us.us.i, label %for.cond4.loopexit.us.us.i
for.body10.lr.ph.split.us.us.us.i: ; preds = %for.body10.lr.ph.us.us.i
%18 = load i8, ptr %arrayidx.us.i, align 8, !tbaa !14
br label %for.body10.us.us.us.i
for.body10.us.us.us.i: ; preds = %for.inc.us.us.us.i, %for.body10.lr.ph.split.us.us.us.i
%indvars.iv110.i = phi i64 [ %indvars.iv.next111.i, %for.inc.us.us.us.i ], [ %indvars.iv.i, %for.body10.lr.ph.split.us.us.us.i ]
%flag.389.us.us.us.i = phi i32 [ %flag.4.us.us.us.i, %for.inc.us.us.us.i ], [ %flag.292.us.us.i, %for.body10.lr.ph.split.us.us.us.i ]
%arrayidx18.us.us.us.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv110.i
%19 = load i8, ptr %arrayidx18.us.us.us.i, align 4, !tbaa !14
%cmp21.us.us.us.i = icmp eq i8 %18, %19
br i1 %cmp21.us.us.us.i, label %land.lhs.true23.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true23.us.us.us.i: ; preds = %for.body10.us.us.us.i
%num29.us.us.us.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv110.i, i32 1
%20 = load i32, ptr %num29.us.us.us.i, align 4, !tbaa !11
%cmp30.us.us.us.i = icmp eq i32 %16, %20
br i1 %cmp30.us.us.us.i, label %land.lhs.true32.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true32.us.us.us.i: ; preds = %land.lhs.true23.us.us.us.i
%21 = load i32, ptr %num38.us.us.i, align 4, !tbaa !11
%cmp39.us.us.us.i = icmp eq i32 %16, %21
br i1 %cmp39.us.us.us.i, label %land.lhs.true41.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true41.us.us.us.i: ; preds = %land.lhs.true32.us.us.us.i
%22 = load i8, ptr %arrayidx12.us.us.i, align 8, !tbaa !14
%23 = load i8, ptr %arrayidx37.us.us.i, align 4, !tbaa !14
%cmp50.us.us.us.i = icmp eq i8 %22, %23
%spec.select.us.us.us.i = select i1 %cmp50.us.us.us.i, i32 1, i32 %flag.389.us.us.us.i
br label %for.inc.us.us.us.i
for.inc.us.us.us.i: ; preds = %land.lhs.true41.us.us.us.i, %land.lhs.true32.us.us.us.i, %land.lhs.true23.us.us.us.i, %for.body10.us.us.us.i
%flag.4.us.us.us.i = phi i32 [ %flag.389.us.us.us.i, %land.lhs.true32.us.us.us.i ], [ %flag.389.us.us.us.i, %land.lhs.true23.us.us.us.i ], [ %flag.389.us.us.us.i, %for.body10.us.us.us.i ], [ %spec.select.us.us.us.i, %land.lhs.true41.us.us.us.i ]
%indvars.iv.next111.i = add nuw nsw i64 %indvars.iv110.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next111.i, %15
br i1 %exitcond.not.i, label %for.cond4.loopexit.us.us.i, label %for.body10.us.us.us.i, !llvm.loop !21
for.cond4.for.inc55_crit_edge.us.us.i: ; preds = %for.cond4.loopexit.us.us.i
%indvars.iv.next121.i = add nuw nsw i64 %indvars.iv120.i, 1
%exitcond124.not.i = icmp eq i64 %indvars.iv.next121.i, %15
br i1 %exitcond124.not.i, label %for.cond.loopexit.us.i, label %for.cond4.preheader.us.us.i, !llvm.loop !22
for.end60.i: ; preds = %for.cond.loopexit.us.i
%24 = icmp eq i32 %flag.1.lcssa.us.i, 0
%spec.select.i = select i1 %24, ptr @str.7, ptr @str
br label %isStable.exit
isStable.exit: ; preds = %for.end37, %for.end60.i
%str.sink.i = phi ptr [ @str.7, %for.end37 ], [ %spec.select.i, %for.end60.i ]
%puts.i = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink.i)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Selectionsort(ptr nocapture noundef %C) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp62 = icmp sgt i32 %0, 1
br i1 %cmp62, label %for.cond1.preheader.preheader, label %for.cond19.preheader
for.cond1.preheader.preheader: ; preds = %entry
%sub = add nsw i32 %0, -1
%1 = zext i32 %0 to i64
%wide.trip.count70 = zext i32 %sub to i64
%wide.trip.count = zext i32 %0 to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%cmp259 = icmp ult i64 %indvars.iv, %1
%2 = trunc i64 %indvars.iv to i32
br i1 %cmp259, label %for.body3, label %for.end
for.cond19.preheader: ; preds = %for.end, %entry
%cmp2064 = icmp sgt i32 %0, 0
br i1 %cmp2064, label %if.end24.peel, label %for.end33
if.end24.peel: ; preds = %for.cond19.preheader
%num29.peel.phi.trans.insert = getelementptr inbounds %struct.card, ptr %C, i64 0, i32 1
%.pre76 = load i32, ptr %num29.peel.phi.trans.insert, align 4, !tbaa !11
%.pre = load i8, ptr %C, align 4, !tbaa !14
%conv.peel = sext i8 %.pre to i32
%call30.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.peel, i32 noundef %.pre76)
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp20.peel = icmp sgt i32 %3, 1
br i1 %cmp20.peel, label %if.end24, label %for.end33
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body3 ], [ %indvars.iv, %for.cond1.preheader ]
%minj.061 = phi i32 [ %spec.select, %for.body3 ], [ %2, %for.cond1.preheader ]
%num = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv66, i32 1
%4 = load i32, ptr %num, align 4, !tbaa !11
%idxprom4 = sext i32 %minj.061 to i64
%num6 = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom4, i32 1
%5 = load i32, ptr %num6, align 4, !tbaa !11
%cmp7 = icmp slt i32 %4, %5
%6 = trunc i64 %indvars.iv66 to i32
%spec.select = select i1 %cmp7, i32 %6, i32 %minj.061
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body3, !llvm.loop !23
for.end: ; preds = %for.body3, %for.cond1.preheader
%minj.0.lcssa = phi i32 [ %2, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%arrayidx9 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv
%7 = load i64, ptr %arrayidx9, align 4
%idxprom12 = sext i32 %minj.0.lcssa to i64
%arrayidx13 = getelementptr inbounds %struct.card, ptr %C, i64 %idxprom12
%8 = load i64, ptr %arrayidx13, align 4
store i64 %8, ptr %arrayidx9, align 4
store i64 %7, ptr %arrayidx13, align 4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond71.not = icmp eq i64 %indvars.iv.next, %wide.trip.count70
br i1 %exitcond71.not, label %for.cond19.preheader, label %for.cond1.preheader, !llvm.loop !24
if.end24: ; preds = %if.end24.peel, %if.end24
%indvars.iv72 = phi i64 [ %indvars.iv.next73, %if.end24 ], [ 1, %if.end24.peel ]
%putchar58 = tail call i32 @putchar(i32 32)
%arrayidx26 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv72
%9 = load i8, ptr %arrayidx26, align 4, !tbaa !14
%conv = sext i8 %9 to i32
%num29 = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv72, i32 1
%10 = load i32, ptr %num29, align 4, !tbaa !11
%call30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv, i32 noundef %10)
%indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
%11 = load i32, ptr @n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp20 = icmp slt i64 %indvars.iv.next73, %12
br i1 %cmp20, label %if.end24, label %for.end33, !llvm.loop !25
for.end33: ; preds = %if.end24, %if.end24.peel, %for.cond19.preheader
%putchar = tail call i32 @putchar(i32 10)
%13 = load i32, ptr @n, align 4, !tbaa !5
%cmp105.i = icmp sgt i32 %13, 0
br i1 %cmp105.i, label %for.body.us.preheader.i, label %isStable.exit
for.body.us.preheader.i: ; preds = %for.end33
%14 = zext i32 %13 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv125.i = phi i64 [ 0, %for.body.us.preheader.i ], [ %indvars.iv.next126.i, %for.cond.loopexit.us.i ]
%indvars.iv118.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next119.i, %for.cond.loopexit.us.i ]
%flag.0107.us.i = phi i32 [ 0, %for.body.us.preheader.i ], [ %flag.1.lcssa.us.i, %for.cond.loopexit.us.i ]
%indvars.iv.next126.i = add nuw nsw i64 %indvars.iv125.i, 1
%cmp293.us.i = icmp ult i64 %indvars.iv.next126.i, %14
br i1 %cmp293.us.i, label %for.cond4.preheader.lr.ph.us.i, label %for.cond.loopexit.us.i
for.cond.loopexit.us.i: ; preds = %for.cond4.for.inc55_crit_edge.us.us.i, %for.body.us.i
%flag.1.lcssa.us.i = phi i32 [ %flag.0107.us.i, %for.body.us.i ], [ %flag.3.lcssa.us.us.i, %for.cond4.for.inc55_crit_edge.us.us.i ]
%indvars.iv.next119.i = add nuw nsw i64 %indvars.iv118.i, 1
%exitcond129.not.i = icmp eq i64 %indvars.iv.next126.i, %14
br i1 %exitcond129.not.i, label %for.end60.i, label %for.body.us.i, !llvm.loop !19
for.cond4.preheader.lr.ph.us.i: ; preds = %for.body.us.i
%num.us.i = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv125.i, i32 1
%arrayidx.us.i = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv125.i
br label %for.cond4.preheader.us.us.i
for.cond4.preheader.us.us.i: ; preds = %for.cond4.for.inc55_crit_edge.us.us.i, %for.cond4.preheader.lr.ph.us.i
%indvars.iv120.i = phi i64 [ %indvars.iv.next121.i, %for.cond4.for.inc55_crit_edge.us.us.i ], [ %indvars.iv118.i, %for.cond4.preheader.lr.ph.us.i ]
%flag.195.us.us.i = phi i32 [ %flag.3.lcssa.us.us.i, %for.cond4.for.inc55_crit_edge.us.us.i ], [ %flag.0107.us.i, %for.cond4.preheader.lr.ph.us.i ]
%arrayidx12.us.us.i = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv120.i
%num13.us.us.i = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv120.i, i32 1
br label %for.body6.us.us.i
for.body6.us.us.i: ; preds = %for.cond4.loopexit.us.us.i, %for.cond4.preheader.us.us.i
%indvars.iv113.i = phi i64 [ %indvars.iv.next114.i, %for.cond4.loopexit.us.us.i ], [ 0, %for.cond4.preheader.us.us.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.cond4.loopexit.us.us.i ], [ 1, %for.cond4.preheader.us.us.i ]
%flag.292.us.us.i = phi i32 [ %flag.3.lcssa.us.us.i, %for.cond4.loopexit.us.us.i ], [ %flag.195.us.us.i, %for.cond4.preheader.us.us.i ]
%indvars.iv.next114.i = add nuw nsw i64 %indvars.iv113.i, 1
%cmp987.us.us.i = icmp ult i64 %indvars.iv.next114.i, %14
br i1 %cmp987.us.us.i, label %for.body10.lr.ph.us.us.i, label %for.cond4.loopexit.us.us.i
for.cond4.loopexit.us.us.i: ; preds = %for.inc.us.us.us.i, %for.body10.lr.ph.us.us.i, %for.body6.us.us.i
%flag.3.lcssa.us.us.i = phi i32 [ %flag.292.us.us.i, %for.body6.us.us.i ], [ %flag.292.us.us.i, %for.body10.lr.ph.us.us.i ], [ %flag.4.us.us.us.i, %for.inc.us.us.us.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond117.not.i = icmp eq i64 %indvars.iv.next114.i, %14
br i1 %exitcond117.not.i, label %for.cond4.for.inc55_crit_edge.us.us.i, label %for.body6.us.us.i, !llvm.loop !20
for.body10.lr.ph.us.us.i: ; preds = %for.body6.us.us.i
%15 = load i32, ptr %num.us.i, align 4, !tbaa !11
%16 = load i32, ptr %num13.us.us.i, align 4, !tbaa !11
%cmp14.us.us.i = icmp eq i32 %15, %16
%num38.us.us.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv113.i, i32 1
%arrayidx37.us.us.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv113.i
br i1 %cmp14.us.us.i, label %for.body10.lr.ph.split.us.us.us.i, label %for.cond4.loopexit.us.us.i
for.body10.lr.ph.split.us.us.us.i: ; preds = %for.body10.lr.ph.us.us.i
%17 = load i8, ptr %arrayidx.us.i, align 8, !tbaa !14
br label %for.body10.us.us.us.i
for.body10.us.us.us.i: ; preds = %for.inc.us.us.us.i, %for.body10.lr.ph.split.us.us.us.i
%indvars.iv110.i = phi i64 [ %indvars.iv.next111.i, %for.inc.us.us.us.i ], [ %indvars.iv.i, %for.body10.lr.ph.split.us.us.us.i ]
%flag.389.us.us.us.i = phi i32 [ %flag.4.us.us.us.i, %for.inc.us.us.us.i ], [ %flag.292.us.us.i, %for.body10.lr.ph.split.us.us.us.i ]
%arrayidx18.us.us.us.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv110.i
%18 = load i8, ptr %arrayidx18.us.us.us.i, align 4, !tbaa !14
%cmp21.us.us.us.i = icmp eq i8 %17, %18
br i1 %cmp21.us.us.us.i, label %land.lhs.true23.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true23.us.us.us.i: ; preds = %for.body10.us.us.us.i
%num29.us.us.us.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv110.i, i32 1
%19 = load i32, ptr %num29.us.us.us.i, align 4, !tbaa !11
%cmp30.us.us.us.i = icmp eq i32 %15, %19
br i1 %cmp30.us.us.us.i, label %land.lhs.true32.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true32.us.us.us.i: ; preds = %land.lhs.true23.us.us.us.i
%20 = load i32, ptr %num38.us.us.i, align 4, !tbaa !11
%cmp39.us.us.us.i = icmp eq i32 %15, %20
br i1 %cmp39.us.us.us.i, label %land.lhs.true41.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true41.us.us.us.i: ; preds = %land.lhs.true32.us.us.us.i
%21 = load i8, ptr %arrayidx12.us.us.i, align 8, !tbaa !14
%22 = load i8, ptr %arrayidx37.us.us.i, align 4, !tbaa !14
%cmp50.us.us.us.i = icmp eq i8 %21, %22
%spec.select.us.us.us.i = select i1 %cmp50.us.us.us.i, i32 1, i32 %flag.389.us.us.us.i
br label %for.inc.us.us.us.i
for.inc.us.us.us.i: ; preds = %land.lhs.true41.us.us.us.i, %land.lhs.true32.us.us.us.i, %land.lhs.true23.us.us.us.i, %for.body10.us.us.us.i
%flag.4.us.us.us.i = phi i32 [ %flag.389.us.us.us.i, %land.lhs.true32.us.us.us.i ], [ %flag.389.us.us.us.i, %land.lhs.true23.us.us.us.i ], [ %flag.389.us.us.us.i, %for.body10.us.us.us.i ], [ %spec.select.us.us.us.i, %land.lhs.true41.us.us.us.i ]
%indvars.iv.next111.i = add nuw nsw i64 %indvars.iv110.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next111.i, %14
br i1 %exitcond.not.i, label %for.cond4.loopexit.us.us.i, label %for.body10.us.us.us.i, !llvm.loop !21
for.cond4.for.inc55_crit_edge.us.us.i: ; preds = %for.cond4.loopexit.us.us.i
%indvars.iv.next121.i = add nuw nsw i64 %indvars.iv120.i, 1
%exitcond124.not.i = icmp eq i64 %indvars.iv.next121.i, %14
br i1 %exitcond124.not.i, label %for.cond.loopexit.us.i, label %for.cond4.preheader.us.us.i, !llvm.loop !22
for.end60.i: ; preds = %for.cond.loopexit.us.i
%23 = icmp eq i32 %flag.1.lcssa.us.i, 0
%spec.select.i = select i1 %23, ptr @str.7, ptr @str
br label %isStable.exit
isStable.exit: ; preds = %for.end33, %for.end60.i
%str.sink.i = phi ptr [ @str.7, %for.end33 ], [ %spec.select.i, %for.end60.i ]
%puts.i = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink.i)
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: nofree nounwind uwtable
define dso_local void @isStable(ptr nocapture noundef readonly %out) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp105 = icmp sgt i32 %0, 0
br i1 %cmp105, label %for.body.us.preheader, label %if.end65
for.body.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%wide.trip.count128 = zext i32 %0 to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond.loopexit.us
%indvars.iv125 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next126, %for.cond.loopexit.us ]
%indvars.iv118 = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next119, %for.cond.loopexit.us ]
%flag.0107.us = phi i32 [ 0, %for.body.us.preheader ], [ %flag.1.lcssa.us, %for.cond.loopexit.us ]
%indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
%cmp293.us = icmp ult i64 %indvars.iv.next126, %1
br i1 %cmp293.us, label %for.cond4.preheader.lr.ph.us, label %for.cond.loopexit.us
for.cond.loopexit.us: ; preds = %for.cond4.for.inc55_crit_edge.us.us, %for.body.us
%flag.1.lcssa.us = phi i32 [ %flag.0107.us, %for.body.us ], [ %flag.3.lcssa.us.us, %for.cond4.for.inc55_crit_edge.us.us ]
%indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
%exitcond129.not = icmp eq i64 %indvars.iv.next126, %wide.trip.count128
br i1 %exitcond129.not, label %for.end60, label %for.body.us, !llvm.loop !19
for.cond4.preheader.lr.ph.us: ; preds = %for.body.us
%num.us = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv125, i32 1
%arrayidx.us = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv125
br label %for.cond4.preheader.us.us
for.cond4.preheader.us.us: ; preds = %for.cond4.for.inc55_crit_edge.us.us, %for.cond4.preheader.lr.ph.us
%indvars.iv120 = phi i64 [ %indvars.iv.next121, %for.cond4.for.inc55_crit_edge.us.us ], [ %indvars.iv118, %for.cond4.preheader.lr.ph.us ]
%flag.195.us.us = phi i32 [ %flag.3.lcssa.us.us, %for.cond4.for.inc55_crit_edge.us.us ], [ %flag.0107.us, %for.cond4.preheader.lr.ph.us ]
%arrayidx12.us.us = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv120
%num13.us.us = getelementptr inbounds [36 x %struct.card], ptr @C, i64 0, i64 %indvars.iv120, i32 1
br label %for.body6.us.us
for.body6.us.us: ; preds = %for.cond4.loopexit.us.us, %for.cond4.preheader.us.us
%indvars.iv113 = phi i64 [ %indvars.iv.next114, %for.cond4.loopexit.us.us ], [ 0, %for.cond4.preheader.us.us ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond4.loopexit.us.us ], [ 1, %for.cond4.preheader.us.us ]
%flag.292.us.us = phi i32 [ %flag.3.lcssa.us.us, %for.cond4.loopexit.us.us ], [ %flag.195.us.us, %for.cond4.preheader.us.us ]
%indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
%cmp987.us.us = icmp ult i64 %indvars.iv.next114, %1
br i1 %cmp987.us.us, label %for.body10.lr.ph.us.us, label %for.cond4.loopexit.us.us
for.cond4.loopexit.us.us: ; preds = %for.inc.us.us.us, %for.body10.lr.ph.us.us, %for.body6.us.us
%flag.3.lcssa.us.us = phi i32 [ %flag.292.us.us, %for.body6.us.us ], [ %flag.292.us.us, %for.body10.lr.ph.us.us ], [ %flag.4.us.us.us, %for.inc.us.us.us ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond117.not = icmp eq i64 %indvars.iv.next114, %wide.trip.count128
br i1 %exitcond117.not, label %for.cond4.for.inc55_crit_edge.us.us, label %for.body6.us.us, !llvm.loop !20
for.body10.lr.ph.us.us: ; preds = %for.body6.us.us
%2 = load i32, ptr %num.us, align 4, !tbaa !11
%3 = load i32, ptr %num13.us.us, align 4, !tbaa !11
%cmp14.us.us = icmp eq i32 %2, %3
%num38.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv113, i32 1
%arrayidx37.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv113
br i1 %cmp14.us.us, label %for.body10.lr.ph.split.us.us.us, label %for.cond4.loopexit.us.us
for.body10.lr.ph.split.us.us.us: ; preds = %for.body10.lr.ph.us.us
%4 = load i8, ptr %arrayidx.us, align 8, !tbaa !14
br label %for.body10.us.us.us
for.body10.us.us.us: ; preds = %for.inc.us.us.us, %for.body10.lr.ph.split.us.us.us
%indvars.iv110 = phi i64 [ %indvars.iv.next111, %for.inc.us.us.us ], [ %indvars.iv, %for.body10.lr.ph.split.us.us.us ]
%flag.389.us.us.us = phi i32 [ %flag.4.us.us.us, %for.inc.us.us.us ], [ %flag.292.us.us, %for.body10.lr.ph.split.us.us.us ]
%arrayidx18.us.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv110
%5 = load i8, ptr %arrayidx18.us.us.us, align 4, !tbaa !14
%cmp21.us.us.us = icmp eq i8 %4, %5
br i1 %cmp21.us.us.us, label %land.lhs.true23.us.us.us, label %for.inc.us.us.us
land.lhs.true23.us.us.us: ; preds = %for.body10.us.us.us
%num29.us.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv110, i32 1
%6 = load i32, ptr %num29.us.us.us, align 4, !tbaa !11
%cmp30.us.us.us = icmp eq i32 %2, %6
br i1 %cmp30.us.us.us, label %land.lhs.true32.us.us.us, label %for.inc.us.us.us
land.lhs.true32.us.us.us: ; preds = %land.lhs.true23.us.us.us
%7 = load i32, ptr %num38.us.us, align 4, !tbaa !11
%cmp39.us.us.us = icmp eq i32 %2, %7
br i1 %cmp39.us.us.us, label %land.lhs.true41.us.us.us, label %for.inc.us.us.us
land.lhs.true41.us.us.us: ; preds = %land.lhs.true32.us.us.us
%8 = load i8, ptr %arrayidx12.us.us, align 8, !tbaa !14
%9 = load i8, ptr %arrayidx37.us.us, align 4, !tbaa !14
%cmp50.us.us.us = icmp eq i8 %8, %9
%spec.select.us.us.us = select i1 %cmp50.us.us.us, i32 1, i32 %flag.389.us.us.us
br label %for.inc.us.us.us
for.inc.us.us.us: ; preds = %land.lhs.true41.us.us.us, %land.lhs.true32.us.us.us, %land.lhs.true23.us.us.us, %for.body10.us.us.us
%flag.4.us.us.us = phi i32 [ %flag.389.us.us.us, %land.lhs.true32.us.us.us ], [ %flag.389.us.us.us, %land.lhs.true23.us.us.us ], [ %flag.389.us.us.us, %for.body10.us.us.us ], [ %spec.select.us.us.us, %land.lhs.true41.us.us.us ]
%indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
%exitcond.not = icmp eq i64 %indvars.iv.next111, %wide.trip.count128
br i1 %exitcond.not, label %for.cond4.loopexit.us.us, label %for.body10.us.us.us, !llvm.loop !21
for.cond4.for.inc55_crit_edge.us.us: ; preds = %for.cond4.loopexit.us.us
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%exitcond124.not = icmp eq i64 %indvars.iv.next121, %wide.trip.count128
br i1 %exitcond124.not, label %for.cond.loopexit.us, label %for.cond4.preheader.us.us, !llvm.loop !22
for.end60: ; preds = %for.cond.loopexit.us
%10 = icmp eq i32 %flag.1.lcssa.us, 0
%spec.select = select i1 %10, ptr @str.7, ptr @str
br label %if.end65
if.end65: ; preds = %for.end60, %entry
%str.sink = phi ptr [ @str.7, %entry ], [ %spec.select, %for.end60 ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
ret void
}
; 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 = !{!12, !6, i64 4}
!12 = !{!"", !7, i64 0, !6, i64 4}
!13 = distinct !{!13, !10}
!14 = !{!12, !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18}
!18 = !{!"llvm.loop.peeled.count", i32 1}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10, !18}
|
#include <stdio.h>
#include <stdlib.h>
#define true 1
#define false 0
typedef struct{
char kind;
int num;
} data;
int N;
int isStable(data *,data *);
void BubbleSort(data *,int);
void SelectionSort(data *,int);
int main()
{
int i;
data *in, *B, *S;
scanf("%d",&N);
in = (data *)malloc(N * sizeof(data));
B = (data *)malloc(N * sizeof(data));
S = (data *)malloc(N * sizeof(data));
for(i = 0 ; i < N ; i++){
scanf(" %c%d",&in[i].kind,&in[i].num);
B[i] = in[i];
S[i] = in[i]; }
BubbleSort(B ,N);
SelectionSort(S, N);
for(i = 0 ; i < N-1 ; i++) printf("%c%d ",B[i].kind,B[i].num);
printf("%c%d\n",B[N-1].kind,B[N-1].num);
if(isStable(in,B) == true) printf("Stable\n");
else printf("Not stable\n");
for(i = 0 ; i < N-1 ; i++) printf("%c%d ",S[i].kind,S[i].num);
printf("%c%d\n",S[N-1].kind,S[N-1].num);
if(isStable(in,S) == true) printf("Stable\n");
else printf("Not stable\n");
free(in);
free(B);
free(S);
return 0;
}
int isStable(data *in,data *out){
int i, j, a, b;
for(i = 0 ; i < N-1 ; i++){
for(j = i+1 ; j < N-1 ; j++){
for(a = 0 ; a < N-1 ; a++){
for(b = a+1 ; b < N-1 ; b++){
if(in[i].num == in[j].num && in[i].num == out[b].num && in[j].num == out[a].num){
if(in[i].kind == out[b].kind && in[j].kind == out[a].kind) return false; }
}
}
}
}
return true;
}
void BubbleSort(data *C,int N){
int i, j, num;
char kind;
for(i = 0 ; i < N-1 ; i++){
for(j = N-1 ; j >= i+1 ; j--){
if(C[j].num < C[j-1].num){
num = C[j].num;
C[j].num = C[j-1].num;
C[j-1].num = num;
kind = C[j].kind;
C[j].kind = C[j-1].kind;
C[j-1].kind = kind; }
}
}
}
void SelectionSort(data *C,int N){
int i, j, minj, for_change_num;
char for_change_kind;
for(i = 0 ; i < N-1 ; i++){
minj = i;
for(j = i ; j <= N-1 ; j++){
if(C[j].num < C[minj].num) minj = j; }
for_change_num = C[i].num;
C[i].num = C[minj].num;
C[minj].num = for_change_num;
for_change_kind = C[i].kind;
C[i].kind = C[minj].kind;
C[minj].kind = for_change_kind;
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114137/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114137/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.data = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@N = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
%0 = load i32, ptr @N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = tail call noalias ptr @malloc(i64 noundef %mul) #7
%call4 = tail call noalias ptr @malloc(i64 noundef %mul) #7
%call7 = tail call noalias ptr @malloc(i64 noundef %mul) #7
%cmp186 = icmp sgt i32 %0, 0
br i1 %cmp186, label %for.body, label %SelectionSort.exit.thread
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv
%num = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv, i32 1
%call11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx, ptr noundef nonnull %num)
%arrayidx13 = getelementptr inbounds %struct.data, ptr %call4, i64 %indvars.iv
%1 = load i64, ptr %arrayidx, align 4
store i64 %1, ptr %arrayidx13, align 4
%arrayidx17 = getelementptr inbounds %struct.data, ptr %call7, i64 %indvars.iv
store i64 %1, ptr %arrayidx17, align 4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr @N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp66.i = icmp sgt i32 %2, 1
br i1 %cmp66.i, label %for.cond2.preheader.preheader.i, label %SelectionSort.exit.thread
SelectionSort.exit.thread: ; preds = %for.end, %entry
%4 = phi i32 [ %2, %for.end ], [ %0, %entry ]
%.pre = add nsw i32 %4, -1
br label %SelectionSort.exit.for.end34_crit_edge
for.cond2.preheader.preheader.i: ; preds = %for.end
%sub.i = add nsw i32 %2, -1
%5 = zext i32 %2 to i64
%6 = add nsw i64 %5, -1
%wide.trip.count.i = zext i32 %sub.i to i64
%num5.phi.trans.insert.i = getelementptr inbounds %struct.data, ptr %call4, i64 %6, i32 1
br label %for.cond2.preheader.i
for.cond2.preheader.i: ; preds = %for.inc39.i, %for.cond2.preheader.preheader.i
%indvars.iv69.i = phi i64 [ 0, %for.cond2.preheader.preheader.i ], [ %indvars.iv.next70.i, %for.inc39.i ]
%.pre.i = load i32, ptr %num5.phi.trans.insert.i, align 4, !tbaa !11
br label %for.body4.i
for.body4.i: ; preds = %for.inc.i, %for.cond2.preheader.i
%7 = phi i32 [ %.pre.i, %for.cond2.preheader.i ], [ %11, %for.inc.i ]
%indvars.iv.i = phi i64 [ %6, %for.cond2.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%num9.i = getelementptr inbounds %struct.data, ptr %call4, i64 %indvars.iv.next.i, i32 1
%8 = load i32, ptr %num9.i, align 4, !tbaa !11
%cmp10.i = icmp slt i32 %7, %8
br i1 %cmp10.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i
%num5.i = getelementptr inbounds %struct.data, ptr %call4, i64 %indvars.iv.i, i32 1
%arrayidx8.i = getelementptr inbounds %struct.data, ptr %call4, i64 %indvars.iv.next.i
%arrayidx.i = getelementptr inbounds %struct.data, ptr %call4, i64 %indvars.iv.i
store i32 %8, ptr %num5.i, align 4, !tbaa !11
store i32 %7, ptr %num9.i, align 4, !tbaa !11
%9 = load i8, ptr %arrayidx.i, align 4, !tbaa !13
%10 = load i8, ptr %arrayidx8.i, align 4, !tbaa !13
store i8 %10, ptr %arrayidx.i, align 4, !tbaa !13
store i8 %9, ptr %arrayidx8.i, align 4, !tbaa !13
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i
%11 = phi i32 [ %8, %for.body4.i ], [ %7, %if.then.i ]
%cmp3.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv69.i
br i1 %cmp3.not.not.i, label %for.body4.i, label %for.inc39.i, !llvm.loop !14
for.inc39.i: ; preds = %for.inc.i
%indvars.iv.next70.i = add nuw nsw i64 %indvars.iv69.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next70.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.cond1.preheader.i, label %for.cond2.preheader.i, !llvm.loop !15
for.cond1.preheader.i: ; preds = %for.inc39.i, %for.end.i
%indvars.iv.i124 = phi i64 [ %indvars.iv.next.i125, %for.end.i ], [ 0, %for.inc39.i ]
%cmp3.not.not59.i = icmp ult i64 %indvars.iv.i124, %5
%12 = trunc i64 %indvars.iv.i124 to i32
br i1 %cmp3.not.not59.i, label %for.body4.i126, label %for.end.i
for.body4.i126: ; preds = %for.cond1.preheader.i, %for.body4.i126
%indvars.iv64.i = phi i64 [ %indvars.iv.next65.i, %for.body4.i126 ], [ %indvars.iv.i124, %for.cond1.preheader.i ]
%minj.060.i = phi i32 [ %spec.select.i, %for.body4.i126 ], [ %12, %for.cond1.preheader.i ]
%num.i = getelementptr inbounds %struct.data, ptr %call7, i64 %indvars.iv64.i, i32 1
%13 = load i32, ptr %num.i, align 4, !tbaa !11
%idxprom5.i = sext i32 %minj.060.i to i64
%num7.i = getelementptr inbounds %struct.data, ptr %call7, i64 %idxprom5.i, i32 1
%14 = load i32, ptr %num7.i, align 4, !tbaa !11
%cmp8.i = icmp slt i32 %13, %14
%15 = trunc i64 %indvars.iv64.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %15, i32 %minj.060.i
%indvars.iv.next65.i = add nuw nsw i64 %indvars.iv64.i, 1
%exitcond.not.i127 = icmp eq i64 %indvars.iv.next65.i, %5
br i1 %exitcond.not.i127, label %for.end.i, label %for.body4.i126, !llvm.loop !16
for.end.i: ; preds = %for.body4.i126, %for.cond1.preheader.i
%minj.0.lcssa.i = phi i32 [ %12, %for.cond1.preheader.i ], [ %spec.select.i, %for.body4.i126 ]
%arrayidx10.i = getelementptr inbounds %struct.data, ptr %call7, i64 %indvars.iv.i124
%num11.i = getelementptr inbounds %struct.data, ptr %call7, i64 %indvars.iv.i124, i32 1
%16 = load i32, ptr %num11.i, align 4, !tbaa !11
%idxprom12.i = sext i32 %minj.0.lcssa.i to i64
%arrayidx13.i = getelementptr inbounds %struct.data, ptr %call7, i64 %idxprom12.i
%num14.i = getelementptr inbounds %struct.data, ptr %call7, i64 %idxprom12.i, i32 1
%17 = load i32, ptr %num14.i, align 4, !tbaa !11
store i32 %17, ptr %num11.i, align 4, !tbaa !11
store i32 %16, ptr %num14.i, align 4, !tbaa !11
%18 = load i8, ptr %arrayidx10.i, align 4, !tbaa !13
%19 = load i8, ptr %arrayidx13.i, align 4, !tbaa !13
store i8 %19, ptr %arrayidx10.i, align 4, !tbaa !13
store i8 %18, ptr %arrayidx13.i, align 4, !tbaa !13
%indvars.iv.next.i125 = add nuw nsw i64 %indvars.iv.i124, 1
%exitcond69.not.i = icmp eq i64 %indvars.iv.next.i125, %wide.trip.count.i
br i1 %exitcond69.not.i, label %SelectionSort.exit, label %for.cond1.preheader.i, !llvm.loop !17
SelectionSort.exit: ; preds = %for.end.i
br i1 %cmp66.i, label %for.body23, label %SelectionSort.exit.for.end34_crit_edge
SelectionSort.exit.for.end34_crit_edge: ; preds = %SelectionSort.exit.thread, %SelectionSort.exit
%sub188.pre-phi213 = phi i32 [ %.pre, %SelectionSort.exit.thread ], [ %sub.i, %SelectionSort.exit ]
%.pre206 = sext i32 %sub188.pre-phi213 to i64
br label %for.end34
for.body23: ; preds = %SelectionSort.exit, %for.body23
%indvars.iv200 = phi i64 [ %indvars.iv.next201, %for.body23 ], [ 0, %SelectionSort.exit ]
%arrayidx25 = getelementptr inbounds %struct.data, ptr %call4, i64 %indvars.iv200
%20 = load i8, ptr %arrayidx25, align 4, !tbaa !13
%conv27 = sext i8 %20 to i32
%num30 = getelementptr inbounds %struct.data, ptr %call4, i64 %indvars.iv200, i32 1
%21 = load i32, ptr %num30, align 4, !tbaa !11
%call31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27, i32 noundef %21)
%indvars.iv.next201 = add nuw nsw i64 %indvars.iv200, 1
%22 = load i32, ptr @N, align 4, !tbaa !5
%sub = add nsw i32 %22, -1
%23 = sext i32 %sub to i64
%cmp21 = icmp slt i64 %indvars.iv.next201, %23
br i1 %cmp21, label %for.body23, label %for.end34, !llvm.loop !18
for.end34: ; preds = %for.body23, %SelectionSort.exit.for.end34_crit_edge
%idxprom36.pre-phi = phi i64 [ %.pre206, %SelectionSort.exit.for.end34_crit_edge ], [ %23, %for.body23 ]
%arrayidx37 = getelementptr inbounds %struct.data, ptr %call4, i64 %idxprom36.pre-phi
%24 = load i8, ptr %arrayidx37, align 4, !tbaa !13
%conv39 = sext i8 %24 to i32
%num43 = getelementptr inbounds %struct.data, ptr %call4, i64 %idxprom36.pre-phi, i32 1
%25 = load i32, ptr %num43, align 4, !tbaa !11
%call44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv39, i32 noundef %25)
%26 = load i32, ptr @N, align 4, !tbaa !5
%cmp104.i = icmp sgt i32 %26, 1
br i1 %cmp104.i, label %for.body.us.preheader.i, label %if.end
for.body.us.preheader.i: ; preds = %for.end34
%sub.i128 = add nsw i32 %26, -1
%27 = zext i32 %sub.i128 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv124.i = phi i64 [ 0, %for.body.us.preheader.i ], [ %indvars.iv.next125.i, %for.cond.loopexit.us.i ]
%indvars.iv117.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next118.i, %for.cond.loopexit.us.i ]
%indvars.iv.next125.i = add nuw nsw i64 %indvars.iv124.i, 1
%cmp396.us.i = icmp ult i64 %indvars.iv.next125.i, %27
br i1 %cmp396.us.i, label %for.cond5.preheader.lr.ph.us.i, label %for.cond.loopexit.us.i
for.cond.loopexit.us.i: ; preds = %for.cond5.for.inc57_crit_edge.us.us.i, %for.body.us.i
%indvars.iv.next118.i = add nuw nsw i64 %indvars.iv117.i, 1
%exitcond128.not.i = icmp eq i64 %indvars.iv.next125.i, %27
br i1 %exitcond128.not.i, label %if.end, label %for.body.us.i, !llvm.loop !19
for.cond5.preheader.lr.ph.us.i: ; preds = %for.body.us.i
%arrayidx.us.i = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv124.i
%num.us.i = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv124.i, i32 1
br label %for.cond5.preheader.us.us.i
for.cond5.preheader.us.us.i: ; preds = %for.cond5.for.inc57_crit_edge.us.us.i, %for.cond5.preheader.lr.ph.us.i
%indvars.iv119.i = phi i64 [ %indvars.iv.next120.i, %for.cond5.for.inc57_crit_edge.us.us.i ], [ %indvars.iv117.i, %for.cond5.preheader.lr.ph.us.i ]
%arrayidx15.us.us.i = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv119.i
%num16.us.us.i = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv119.i, i32 1
br label %for.body8.us.us.i
for.body8.us.us.i: ; preds = %for.cond5.loopexit.us.us.i, %for.cond5.preheader.us.us.i
%indvars.iv112.i = phi i64 [ %indvars.iv.next113.i, %for.cond5.loopexit.us.us.i ], [ 0, %for.cond5.preheader.us.us.i ]
%indvars.iv.i129 = phi i64 [ %indvars.iv.next.i130, %for.cond5.loopexit.us.us.i ], [ 1, %for.cond5.preheader.us.us.i ]
%indvars.iv.next113.i = add nuw nsw i64 %indvars.iv112.i, 1
%cmp1292.us.us.i = icmp ult i64 %indvars.iv.next113.i, %27
br i1 %cmp1292.us.us.i, label %for.body13.lr.ph.us.us.i, label %for.cond5.loopexit.us.us.i
for.cond5.loopexit.us.us.i: ; preds = %for.inc.us.us.us.i, %for.body13.lr.ph.us.us.i, %for.body8.us.us.i
%indvars.iv.next.i130 = add nuw nsw i64 %indvars.iv.i129, 1
%exitcond116.not.i = icmp eq i64 %indvars.iv.next113.i, %27
br i1 %exitcond116.not.i, label %for.cond5.for.inc57_crit_edge.us.us.i, label %for.body8.us.us.i, !llvm.loop !20
for.body13.lr.ph.us.us.i: ; preds = %for.body8.us.us.i
%28 = load i32, ptr %num.us.i, align 4, !tbaa !11
%29 = load i32, ptr %num16.us.us.i, align 4, !tbaa !11
%cmp17.us.us.i = icmp eq i32 %28, %29
%arrayidx30.us.us.i = getelementptr inbounds %struct.data, ptr %call4, i64 %indvars.iv112.i
%num31.us.us.i = getelementptr inbounds %struct.data, ptr %call4, i64 %indvars.iv112.i, i32 1
br i1 %cmp17.us.us.i, label %for.body13.us.us.us.i, label %for.cond5.loopexit.us.us.i
for.body13.us.us.us.i: ; preds = %for.body13.lr.ph.us.us.i, %for.inc.us.us.us.i
%indvars.iv109.i = phi i64 [ %indvars.iv.next110.i, %for.inc.us.us.us.i ], [ %indvars.iv.i129, %for.body13.lr.ph.us.us.i ]
%arrayidx22.us.us.us.i = getelementptr inbounds %struct.data, ptr %call4, i64 %indvars.iv109.i
%num23.us.us.us.i = getelementptr inbounds %struct.data, ptr %call4, i64 %indvars.iv109.i, i32 1
%30 = load i32, ptr %num23.us.us.us.i, align 4, !tbaa !11
%cmp24.us.us.us.i = icmp eq i32 %28, %30
br i1 %cmp24.us.us.us.i, label %land.lhs.true25.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true25.us.us.us.i: ; preds = %for.body13.us.us.us.i
%31 = load i32, ptr %num31.us.us.i, align 4, !tbaa !11
%cmp32.us.us.us.i = icmp eq i32 %28, %31
br i1 %cmp32.us.us.us.i, label %if.then.us.us.us.i, label %for.inc.us.us.us.i
if.then.us.us.us.i: ; preds = %land.lhs.true25.us.us.us.i
%32 = load i8, ptr %arrayidx.us.i, align 4, !tbaa !13
%33 = load i8, ptr %arrayidx22.us.us.us.i, align 4, !tbaa !13
%cmp39.us.us.us.i = icmp eq i8 %32, %33
br i1 %cmp39.us.us.us.i, label %land.lhs.true41.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true41.us.us.us.i: ; preds = %if.then.us.us.us.i
%34 = load i8, ptr %arrayidx15.us.us.i, align 4, !tbaa !13
%35 = load i8, ptr %arrayidx30.us.us.i, align 4, !tbaa !13
%cmp50.us.us.us.i = icmp eq i8 %34, %35
br i1 %cmp50.us.us.us.i, label %if.end, label %for.inc.us.us.us.i
for.inc.us.us.us.i: ; preds = %land.lhs.true41.us.us.us.i, %if.then.us.us.us.i, %land.lhs.true25.us.us.us.i, %for.body13.us.us.us.i
%indvars.iv.next110.i = add nuw nsw i64 %indvars.iv109.i, 1
%exitcond.not.i131 = icmp eq i64 %indvars.iv.next110.i, %27
br i1 %exitcond.not.i131, label %for.cond5.loopexit.us.us.i, label %for.body13.us.us.us.i, !llvm.loop !21
for.cond5.for.inc57_crit_edge.us.us.i: ; preds = %for.cond5.loopexit.us.us.i
%indvars.iv.next120.i = add nuw nsw i64 %indvars.iv119.i, 1
%exitcond123.not.i = icmp eq i64 %indvars.iv.next120.i, %27
br i1 %exitcond123.not.i, label %for.cond.loopexit.us.i, label %for.cond5.preheader.us.us.i, !llvm.loop !22
if.end: ; preds = %for.cond.loopexit.us.i, %land.lhs.true41.us.us.us.i, %for.end34
%str.sink = phi ptr [ @str.8, %for.end34 ], [ @str.7, %land.lhs.true41.us.us.us.i ], [ @str.8, %for.cond.loopexit.us.i ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%36 = load i32, ptr @N, align 4, !tbaa !5
%cmp52193 = icmp sgt i32 %36, 1
br i1 %cmp52193, label %for.body54, label %if.end.for.end65_crit_edge
if.end.for.end65_crit_edge: ; preds = %if.end
%sub51192 = add nsw i32 %36, -1
%.pre207 = sext i32 %sub51192 to i64
br label %for.end65
for.body54: ; preds = %if.end, %for.body54
%indvars.iv203 = phi i64 [ %indvars.iv.next204, %for.body54 ], [ 0, %if.end ]
%arrayidx56 = getelementptr inbounds %struct.data, ptr %call7, i64 %indvars.iv203
%37 = load i8, ptr %arrayidx56, align 4, !tbaa !13
%conv58 = sext i8 %37 to i32
%num61 = getelementptr inbounds %struct.data, ptr %call7, i64 %indvars.iv203, i32 1
%38 = load i32, ptr %num61, align 4, !tbaa !11
%call62 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv58, i32 noundef %38)
%indvars.iv.next204 = add nuw nsw i64 %indvars.iv203, 1
%39 = load i32, ptr @N, align 4, !tbaa !5
%sub51 = add nsw i32 %39, -1
%40 = sext i32 %sub51 to i64
%cmp52 = icmp slt i64 %indvars.iv.next204, %40
br i1 %cmp52, label %for.body54, label %for.end65, !llvm.loop !23
for.end65: ; preds = %for.body54, %if.end.for.end65_crit_edge
%idxprom67.pre-phi = phi i64 [ %.pre207, %if.end.for.end65_crit_edge ], [ %40, %for.body54 ]
%arrayidx68 = getelementptr inbounds %struct.data, ptr %call7, i64 %idxprom67.pre-phi
%41 = load i8, ptr %arrayidx68, align 4, !tbaa !13
%conv70 = sext i8 %41 to i32
%num74 = getelementptr inbounds %struct.data, ptr %call7, i64 %idxprom67.pre-phi, i32 1
%42 = load i32, ptr %num74, align 4, !tbaa !11
%call75 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv70, i32 noundef %42)
%43 = load i32, ptr @N, align 4, !tbaa !5
%cmp104.i132 = icmp sgt i32 %43, 1
br i1 %cmp104.i132, label %for.body.us.preheader.i134, label %if.end83
for.body.us.preheader.i134: ; preds = %for.end65
%sub.i135 = add nsw i32 %43, -1
%44 = zext i32 %sub.i135 to i64
br label %for.body.us.i137
for.body.us.i137: ; preds = %for.cond.loopexit.us.i142, %for.body.us.preheader.i134
%indvars.iv124.i138 = phi i64 [ 0, %for.body.us.preheader.i134 ], [ %indvars.iv.next125.i140, %for.cond.loopexit.us.i142 ]
%indvars.iv117.i139 = phi i64 [ 1, %for.body.us.preheader.i134 ], [ %indvars.iv.next118.i143, %for.cond.loopexit.us.i142 ]
%indvars.iv.next125.i140 = add nuw nsw i64 %indvars.iv124.i138, 1
%cmp396.us.i141 = icmp ult i64 %indvars.iv.next125.i140, %44
br i1 %cmp396.us.i141, label %for.cond5.preheader.lr.ph.us.i145, label %for.cond.loopexit.us.i142
for.cond.loopexit.us.i142: ; preds = %for.cond5.for.inc57_crit_edge.us.us.i160, %for.body.us.i137
%indvars.iv.next118.i143 = add nuw nsw i64 %indvars.iv117.i139, 1
%exitcond128.not.i144 = icmp eq i64 %indvars.iv.next125.i140, %44
br i1 %exitcond128.not.i144, label %if.end83, label %for.body.us.i137, !llvm.loop !19
for.cond5.preheader.lr.ph.us.i145: ; preds = %for.body.us.i137
%arrayidx.us.i146 = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv124.i138
%num.us.i147 = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv124.i138, i32 1
br label %for.cond5.preheader.us.us.i148
for.cond5.preheader.us.us.i148: ; preds = %for.cond5.for.inc57_crit_edge.us.us.i160, %for.cond5.preheader.lr.ph.us.i145
%indvars.iv119.i149 = phi i64 [ %indvars.iv.next120.i161, %for.cond5.for.inc57_crit_edge.us.us.i160 ], [ %indvars.iv117.i139, %for.cond5.preheader.lr.ph.us.i145 ]
%arrayidx15.us.us.i150 = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv119.i149
%num16.us.us.i151 = getelementptr inbounds %struct.data, ptr %call1, i64 %indvars.iv119.i149, i32 1
br label %for.body8.us.us.i152
for.body8.us.us.i152: ; preds = %for.cond5.loopexit.us.us.i157, %for.cond5.preheader.us.us.i148
%indvars.iv112.i153 = phi i64 [ %indvars.iv.next113.i155, %for.cond5.loopexit.us.us.i157 ], [ 0, %for.cond5.preheader.us.us.i148 ]
%indvars.iv.i154 = phi i64 [ %indvars.iv.next.i158, %for.cond5.loopexit.us.us.i157 ], [ 1, %for.cond5.preheader.us.us.i148 ]
%indvars.iv.next113.i155 = add nuw nsw i64 %indvars.iv112.i153, 1
%cmp1292.us.us.i156 = icmp ult i64 %indvars.iv.next113.i155, %44
br i1 %cmp1292.us.us.i156, label %for.body13.lr.ph.us.us.i163, label %for.cond5.loopexit.us.us.i157
for.cond5.loopexit.us.us.i157: ; preds = %for.inc.us.us.us.i172, %for.body13.lr.ph.us.us.i163, %for.body8.us.us.i152
%indvars.iv.next.i158 = add nuw nsw i64 %indvars.iv.i154, 1
%exitcond116.not.i159 = icmp eq i64 %indvars.iv.next113.i155, %44
br i1 %exitcond116.not.i159, label %for.cond5.for.inc57_crit_edge.us.us.i160, label %for.body8.us.us.i152, !llvm.loop !20
for.body13.lr.ph.us.us.i163: ; preds = %for.body8.us.us.i152
%45 = load i32, ptr %num.us.i147, align 4, !tbaa !11
%46 = load i32, ptr %num16.us.us.i151, align 4, !tbaa !11
%cmp17.us.us.i164 = icmp eq i32 %45, %46
%arrayidx30.us.us.i165 = getelementptr inbounds %struct.data, ptr %call7, i64 %indvars.iv112.i153
%num31.us.us.i166 = getelementptr inbounds %struct.data, ptr %call7, i64 %indvars.iv112.i153, i32 1
br i1 %cmp17.us.us.i164, label %for.body13.us.us.us.i167, label %for.cond5.loopexit.us.us.i157
for.body13.us.us.us.i167: ; preds = %for.body13.lr.ph.us.us.i163, %for.inc.us.us.us.i172
%indvars.iv109.i168 = phi i64 [ %indvars.iv.next110.i173, %for.inc.us.us.us.i172 ], [ %indvars.iv.i154, %for.body13.lr.ph.us.us.i163 ]
%arrayidx22.us.us.us.i169 = getelementptr inbounds %struct.data, ptr %call7, i64 %indvars.iv109.i168
%num23.us.us.us.i170 = getelementptr inbounds %struct.data, ptr %call7, i64 %indvars.iv109.i168, i32 1
%47 = load i32, ptr %num23.us.us.us.i170, align 4, !tbaa !11
%cmp24.us.us.us.i171 = icmp eq i32 %45, %47
br i1 %cmp24.us.us.us.i171, label %land.lhs.true25.us.us.us.i175, label %for.inc.us.us.us.i172
land.lhs.true25.us.us.us.i175: ; preds = %for.body13.us.us.us.i167
%48 = load i32, ptr %num31.us.us.i166, align 4, !tbaa !11
%cmp32.us.us.us.i176 = icmp eq i32 %45, %48
br i1 %cmp32.us.us.us.i176, label %if.then.us.us.us.i177, label %for.inc.us.us.us.i172
if.then.us.us.us.i177: ; preds = %land.lhs.true25.us.us.us.i175
%49 = load i8, ptr %arrayidx.us.i146, align 4, !tbaa !13
%50 = load i8, ptr %arrayidx22.us.us.us.i169, align 4, !tbaa !13
%cmp39.us.us.us.i178 = icmp eq i8 %49, %50
br i1 %cmp39.us.us.us.i178, label %land.lhs.true41.us.us.us.i179, label %for.inc.us.us.us.i172
land.lhs.true41.us.us.us.i179: ; preds = %if.then.us.us.us.i177
%51 = load i8, ptr %arrayidx15.us.us.i150, align 4, !tbaa !13
%52 = load i8, ptr %arrayidx30.us.us.i165, align 4, !tbaa !13
%cmp50.us.us.us.i180 = icmp eq i8 %51, %52
br i1 %cmp50.us.us.us.i180, label %if.end83, label %for.inc.us.us.us.i172
for.inc.us.us.us.i172: ; preds = %land.lhs.true41.us.us.us.i179, %if.then.us.us.us.i177, %land.lhs.true25.us.us.us.i175, %for.body13.us.us.us.i167
%indvars.iv.next110.i173 = add nuw nsw i64 %indvars.iv109.i168, 1
%exitcond.not.i174 = icmp eq i64 %indvars.iv.next110.i173, %44
br i1 %exitcond.not.i174, label %for.cond5.loopexit.us.us.i157, label %for.body13.us.us.us.i167, !llvm.loop !21
for.cond5.for.inc57_crit_edge.us.us.i160: ; preds = %for.cond5.loopexit.us.us.i157
%indvars.iv.next120.i161 = add nuw nsw i64 %indvars.iv119.i149, 1
%exitcond123.not.i162 = icmp eq i64 %indvars.iv.next120.i161, %44
br i1 %exitcond123.not.i162, label %for.cond.loopexit.us.i142, label %for.cond5.preheader.us.us.i148, !llvm.loop !22
if.end83: ; preds = %for.cond.loopexit.us.i142, %land.lhs.true41.us.us.us.i179, %for.end65
%str.7.sink = phi ptr [ @str.8, %for.end65 ], [ @str.7, %land.lhs.true41.us.us.us.i179 ], [ @str.8, %for.cond.loopexit.us.i142 ]
%puts120 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
tail call void @free(ptr noundef %call1) #8
tail call void @free(ptr noundef %call4) #8
tail call void @free(ptr noundef %call7) #8
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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @BubbleSort(ptr nocapture noundef %C, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp66 = icmp sgt i32 %N, 1
br i1 %cmp66, label %for.cond2.preheader.preheader, label %for.end40
for.cond2.preheader.preheader: ; preds = %entry
%sub = add nsw i32 %N, -1
%0 = zext i32 %N to i64
%1 = add nsw i64 %0, -1
%wide.trip.count = zext i32 %sub to i64
%num5.phi.trans.insert = getelementptr inbounds %struct.data, ptr %C, i64 %1, i32 1
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.inc39
%indvars.iv69 = phi i64 [ 0, %for.cond2.preheader.preheader ], [ %indvars.iv.next70, %for.inc39 ]
%.pre = load i32, ptr %num5.phi.trans.insert, align 4, !tbaa !11
br label %for.body4
for.body4: ; preds = %for.cond2.preheader, %for.inc
%2 = phi i32 [ %.pre, %for.cond2.preheader ], [ %6, %for.inc ]
%indvars.iv = phi i64 [ %1, %for.cond2.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%num9 = getelementptr inbounds %struct.data, ptr %C, i64 %indvars.iv.next, i32 1
%3 = load i32, ptr %num9, align 4, !tbaa !11
%cmp10 = icmp slt i32 %2, %3
br i1 %cmp10, label %if.then, label %for.inc
if.then: ; preds = %for.body4
%num5 = getelementptr inbounds %struct.data, ptr %C, i64 %indvars.iv, i32 1
%arrayidx8 = getelementptr inbounds %struct.data, ptr %C, i64 %indvars.iv.next
%arrayidx = getelementptr inbounds %struct.data, ptr %C, i64 %indvars.iv
store i32 %3, ptr %num5, align 4, !tbaa !11
store i32 %2, ptr %num9, align 4, !tbaa !11
%4 = load i8, ptr %arrayidx, align 4, !tbaa !13
%5 = load i8, ptr %arrayidx8, align 4, !tbaa !13
store i8 %5, ptr %arrayidx, align 4, !tbaa !13
store i8 %4, ptr %arrayidx8, align 4, !tbaa !13
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%6 = phi i32 [ %3, %for.body4 ], [ %2, %if.then ]
%cmp3.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv69
br i1 %cmp3.not.not, label %for.body4, label %for.inc39, !llvm.loop !14
for.inc39: ; preds = %for.inc
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%exitcond.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count
br i1 %exitcond.not, label %for.end40, label %for.cond2.preheader, !llvm.loop !15
for.end40: ; preds = %for.inc39, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @SelectionSort(ptr nocapture noundef %C, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp62 = icmp sgt i32 %N, 1
br i1 %cmp62, label %for.cond1.preheader.preheader, label %for.end34
for.cond1.preheader.preheader: ; preds = %entry
%sub = add nsw i32 %N, -1
%0 = zext i32 %N to i64
%wide.trip.count68 = zext i32 %sub to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%cmp3.not.not59 = icmp ult i64 %indvars.iv, %0
%1 = trunc i64 %indvars.iv to i32
br i1 %cmp3.not.not59, label %for.body4, label %for.end
for.body4: ; preds = %for.cond1.preheader, %for.body4
%indvars.iv64 = phi i64 [ %indvars.iv.next65, %for.body4 ], [ %indvars.iv, %for.cond1.preheader ]
%minj.060 = phi i32 [ %spec.select, %for.body4 ], [ %1, %for.cond1.preheader ]
%num = getelementptr inbounds %struct.data, ptr %C, i64 %indvars.iv64, i32 1
%2 = load i32, ptr %num, align 4, !tbaa !11
%idxprom5 = sext i32 %minj.060 to i64
%num7 = getelementptr inbounds %struct.data, ptr %C, i64 %idxprom5, i32 1
%3 = load i32, ptr %num7, align 4, !tbaa !11
%cmp8 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv64 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %minj.060
%indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
%exitcond.not = icmp eq i64 %indvars.iv.next65, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body4, !llvm.loop !16
for.end: ; preds = %for.body4, %for.cond1.preheader
%minj.0.lcssa = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body4 ]
%arrayidx10 = getelementptr inbounds %struct.data, ptr %C, i64 %indvars.iv
%num11 = getelementptr inbounds %struct.data, ptr %C, i64 %indvars.iv, i32 1
%5 = load i32, ptr %num11, align 4, !tbaa !11
%idxprom12 = sext i32 %minj.0.lcssa to i64
%arrayidx13 = getelementptr inbounds %struct.data, ptr %C, i64 %idxprom12
%num14 = getelementptr inbounds %struct.data, ptr %C, i64 %idxprom12, i32 1
%6 = load i32, ptr %num14, align 4, !tbaa !11
store i32 %6, ptr %num11, align 4, !tbaa !11
store i32 %5, ptr %num14, align 4, !tbaa !11
%7 = load i8, ptr %arrayidx10, align 4, !tbaa !13
%8 = load i8, ptr %arrayidx13, align 4, !tbaa !13
store i8 %8, ptr %arrayidx10, align 4, !tbaa !13
store i8 %7, ptr %arrayidx13, align 4, !tbaa !13
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond69.not = icmp eq i64 %indvars.iv.next, %wide.trip.count68
br i1 %exitcond69.not, label %for.end34, label %for.cond1.preheader, !llvm.loop !17
for.end34: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %in, ptr nocapture noundef readonly %out) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp104 = icmp sgt i32 %0, 1
br i1 %cmp104, label %for.body.us.preheader, label %cleanup
for.body.us.preheader: ; preds = %entry
%sub = add i32 %0, -1
%1 = zext i32 %sub to i64
%wide.trip.count127 = zext i32 %sub to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond.loopexit.us
%indvars.iv124 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next125, %for.cond.loopexit.us ]
%indvars.iv117 = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next118, %for.cond.loopexit.us ]
%indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
%cmp396.us = icmp ult i64 %indvars.iv.next125, %1
br i1 %cmp396.us, label %for.cond5.preheader.lr.ph.us, label %for.cond.loopexit.us
for.cond.loopexit.us: ; preds = %for.cond5.for.inc57_crit_edge.us.us, %for.body.us
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%exitcond128.not = icmp eq i64 %indvars.iv.next125, %wide.trip.count127
br i1 %exitcond128.not, label %cleanup, label %for.body.us, !llvm.loop !19
for.cond5.preheader.lr.ph.us: ; preds = %for.body.us
%arrayidx.us = getelementptr inbounds %struct.data, ptr %in, i64 %indvars.iv124
%num.us = getelementptr inbounds %struct.data, ptr %in, i64 %indvars.iv124, i32 1
br label %for.cond5.preheader.us.us
for.cond5.preheader.us.us: ; preds = %for.cond5.for.inc57_crit_edge.us.us, %for.cond5.preheader.lr.ph.us
%indvars.iv119 = phi i64 [ %indvars.iv.next120, %for.cond5.for.inc57_crit_edge.us.us ], [ %indvars.iv117, %for.cond5.preheader.lr.ph.us ]
%arrayidx15.us.us = getelementptr inbounds %struct.data, ptr %in, i64 %indvars.iv119
%num16.us.us = getelementptr inbounds %struct.data, ptr %in, i64 %indvars.iv119, i32 1
br label %for.body8.us.us
for.body8.us.us: ; preds = %for.cond5.loopexit.us.us, %for.cond5.preheader.us.us
%indvars.iv112 = phi i64 [ %indvars.iv.next113, %for.cond5.loopexit.us.us ], [ 0, %for.cond5.preheader.us.us ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond5.loopexit.us.us ], [ 1, %for.cond5.preheader.us.us ]
%indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
%cmp1292.us.us = icmp ult i64 %indvars.iv.next113, %1
br i1 %cmp1292.us.us, label %for.body13.lr.ph.us.us, label %for.cond5.loopexit.us.us
for.cond5.loopexit.us.us: ; preds = %for.inc.us.us.us, %for.body13.lr.ph.us.us, %for.body8.us.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond116.not = icmp eq i64 %indvars.iv.next113, %wide.trip.count127
br i1 %exitcond116.not, label %for.cond5.for.inc57_crit_edge.us.us, label %for.body8.us.us, !llvm.loop !20
for.body13.lr.ph.us.us: ; preds = %for.body8.us.us
%2 = load i32, ptr %num.us, align 4, !tbaa !11
%3 = load i32, ptr %num16.us.us, align 4, !tbaa !11
%cmp17.us.us = icmp eq i32 %2, %3
%arrayidx30.us.us = getelementptr inbounds %struct.data, ptr %out, i64 %indvars.iv112
%num31.us.us = getelementptr inbounds %struct.data, ptr %out, i64 %indvars.iv112, i32 1
br i1 %cmp17.us.us, label %for.body13.us.us.us, label %for.cond5.loopexit.us.us
for.body13.us.us.us: ; preds = %for.body13.lr.ph.us.us, %for.inc.us.us.us
%indvars.iv109 = phi i64 [ %indvars.iv.next110, %for.inc.us.us.us ], [ %indvars.iv, %for.body13.lr.ph.us.us ]
%arrayidx22.us.us.us = getelementptr inbounds %struct.data, ptr %out, i64 %indvars.iv109
%num23.us.us.us = getelementptr inbounds %struct.data, ptr %out, i64 %indvars.iv109, i32 1
%4 = load i32, ptr %num23.us.us.us, align 4, !tbaa !11
%cmp24.us.us.us = icmp eq i32 %2, %4
br i1 %cmp24.us.us.us, label %land.lhs.true25.us.us.us, label %for.inc.us.us.us
land.lhs.true25.us.us.us: ; preds = %for.body13.us.us.us
%5 = load i32, ptr %num31.us.us, align 4, !tbaa !11
%cmp32.us.us.us = icmp eq i32 %2, %5
br i1 %cmp32.us.us.us, label %if.then.us.us.us, label %for.inc.us.us.us
if.then.us.us.us: ; preds = %land.lhs.true25.us.us.us
%6 = load i8, ptr %arrayidx.us, align 4, !tbaa !13
%7 = load i8, ptr %arrayidx22.us.us.us, align 4, !tbaa !13
%cmp39.us.us.us = icmp eq i8 %6, %7
br i1 %cmp39.us.us.us, label %land.lhs.true41.us.us.us, label %for.inc.us.us.us
land.lhs.true41.us.us.us: ; preds = %if.then.us.us.us
%8 = load i8, ptr %arrayidx15.us.us, align 4, !tbaa !13
%9 = load i8, ptr %arrayidx30.us.us, align 4, !tbaa !13
%cmp50.us.us.us = icmp eq i8 %8, %9
br i1 %cmp50.us.us.us, label %cleanup, label %for.inc.us.us.us
for.inc.us.us.us: ; preds = %land.lhs.true41.us.us.us, %if.then.us.us.us, %land.lhs.true25.us.us.us, %for.body13.us.us.us
%indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
%exitcond.not = icmp eq i64 %indvars.iv.next110, %wide.trip.count127
br i1 %exitcond.not, label %for.cond5.loopexit.us.us, label %for.body13.us.us.us, !llvm.loop !21
for.cond5.for.inc57_crit_edge.us.us: ; preds = %for.cond5.loopexit.us.us
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%exitcond123.not = icmp eq i64 %indvars.iv.next120, %wide.trip.count127
br i1 %exitcond123.not, label %for.cond.loopexit.us, label %for.cond5.preheader.us.us, !llvm.loop !22
cleanup: ; preds = %for.cond.loopexit.us, %land.lhs.true41.us.us.us, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %land.lhs.true41.us.us.us ], [ 1, %for.cond.loopexit.us ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-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 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(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 4}
!12 = !{!"", !7, i64 0, !6, i64 4}
!13 = !{!12, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
|
#include<stdio.h>
int main(){
char s[36][3], bobble_s[36][3], selection_s[36][3];
int i, j, k, l, n, c, flag, minj, stability = 1;
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%s", s[i]);
for (j = 0; j < 3; j++){
selection_s[i][j] = bobble_s[i][j] = s[i][j];
}
}
i = 0;
flag = 1;
while(flag != 0){
flag = 0;
for (j = n -1; j > i; j--){
if(bobble_s[j][1] < bobble_s[j-1][1]){
for (l = 0; l < 2; l++){
c = bobble_s[j][l];
bobble_s[j][l] = bobble_s[j-1][l];
bobble_s[j-1][l] = c;
flag = 1;
}
}
}
i++;
}
printf("%s", bobble_s[0]);
for(k = 1; k < n; k++){
printf(" %s", bobble_s[k]);
}
printf("\n");
for (i = 0; i < n; i++){
for (j = i + 1; j < n; j++){
for (k = 0; k < n; k++){
for(l = k + 1; l < n; l++){
if(s[i][1] == s[j][1] && s[i][0] == bobble_s[l][0] && s[j][0] == bobble_s[k][0] && s[i][1] == bobble_s[l][1] && s[j][1] == bobble_s[k][1]){
stability = 0;
}
}
}
}
}
if(stability == 1){
printf("Stable\n");
} else if (stability == 0){
printf("Not stable\n");
}
stability = 1;
for (i = 0; i < n; i++){
minj = i;
for (j = i; j < n; j++){
if(selection_s[j][1] < selection_s[minj][1]){
minj = j;
}
}
if(minj != i){
for (k = 0; k < 2; k++){
c = selection_s[i][k];
selection_s[i][k] = selection_s[minj][k];
selection_s[minj][k] = c;
}
}
}
printf("%s", selection_s[0]);
for (i = 1; i < n; i++){
printf(" %s", selection_s[i]);
}
printf("\n");
for (i = 0; i < n; i++){
for (j = i + 1; j < n; j++){
for (k = 0; k < n; k++){
for(l = k + 1; l < n; l++){
if(s[i][1] == s[j][1] && s[i][0] == selection_s[l][0] && s[j][0] == selection_s[k][0] && s[i][1] == bobble_s[l][1] && s[j][1] == bobble_s[k][1]){
stability = 0;
}
}
}
}
}
if(stability == 1){
printf("Stable\n");
} else if (stability == 0){
printf("Not stable\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114180/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114180/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %s\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [36 x [3 x i8]], align 16
%bobble_s = alloca [36 x [3 x i8]], align 16
%selection_s = alloca [36 x [3 x i8]], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %bobble_s) #5
call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %selection_s) #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
%cmp440 = icmp sgt i32 %0, 0
br i1 %cmp440, label %for.body, label %entry.while.cond.preheader_crit_edge
entry.while.cond.preheader_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %while.cond.preheader
while.cond.preheader: ; preds = %for.body, %entry.while.cond.preheader_crit_edge
%.pre-phi = phi i64 [ %.pre, %entry.while.cond.preheader_crit_edge ], [ %5, %for.body ]
%.lcssa = phi i32 [ %0, %entry.while.cond.preheader_crit_edge ], [ %4, %for.body ]
%j.1443 = add nsw i32 %.lcssa, -1
%1 = add nsw i64 %.pre-phi, -1
%2 = sext i32 %j.1443 to i64
br label %for.cond21.preheader
for.body: ; preds = %entry, %for.body
%indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
%3 = mul nuw nsw i64 %indvar, 3
%scevgep513 = getelementptr i8, ptr %selection_s, i64 %3
%scevgep514 = getelementptr i8, ptr %s, i64 %3
%scevgep = getelementptr i8, ptr %bobble_s, i64 %3
%arrayidx = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvar
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %scevgep, ptr noundef nonnull align 1 dereferenceable(3) %scevgep514, i64 3, i1 false), !tbaa !9
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %scevgep513, ptr noundef nonnull align 1 dereferenceable(3) %scevgep514, i64 3, i1 false), !tbaa !9
%indvar.next = add nuw nsw i64 %indvar, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvar.next, %5
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !10
for.cond21.preheader: ; preds = %while.cond.preheader, %for.end62
%indvars.iv530 = phi i64 [ 0, %while.cond.preheader ], [ %indvars.iv.next531, %for.end62 ]
%cmp22444 = icmp slt i64 %indvars.iv530, %2
br i1 %cmp22444, label %for.body23, label %while.end
for.body23: ; preds = %for.cond21.preheader, %for.inc61
%indvars.iv524 = phi i64 [ %indvars.iv.next525, %for.inc61 ], [ %.pre-phi, %for.cond21.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc61 ], [ %1, %for.cond21.preheader ]
%flag.1446 = phi i32 [ %flag.3, %for.inc61 ], [ 0, %for.cond21.preheader ]
%indvars.iv.next525 = add nsw i64 %indvars.iv524, -1
%arrayidx26 = getelementptr inbounds [36 x [3 x i8]], ptr %bobble_s, i64 0, i64 %indvars.iv, i64 1
%6 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%7 = add nsw i64 %indvars.iv524, -2
%arrayidx30 = getelementptr inbounds [36 x [3 x i8]], ptr %bobble_s, i64 0, i64 %7, i64 1
%8 = load i8, ptr %arrayidx30, align 1, !tbaa !9
%cmp32 = icmp slt i8 %6, %8
br i1 %cmp32, label %for.body37.preheader, label %for.inc61
for.body37.preheader: ; preds = %for.body23
%arrayidx41 = getelementptr inbounds [36 x [3 x i8]], ptr %bobble_s, i64 0, i64 %indvars.iv, i64 0
%9 = load i8, ptr %arrayidx41, align 1, !tbaa !9
%arrayidx47 = getelementptr inbounds [36 x [3 x i8]], ptr %bobble_s, i64 0, i64 %7, i64 0
%10 = load i8, ptr %arrayidx47, align 1, !tbaa !9
store i8 %10, ptr %arrayidx41, align 1, !tbaa !9
store i8 %9, ptr %arrayidx47, align 1, !tbaa !9
%11 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%12 = load i8, ptr %arrayidx30, align 1, !tbaa !9
store i8 %12, ptr %arrayidx26, align 1, !tbaa !9
store i8 %11, ptr %arrayidx30, align 1, !tbaa !9
br label %for.inc61
for.inc61: ; preds = %for.body37.preheader, %for.body23
%flag.3 = phi i32 [ %flag.1446, %for.body23 ], [ 1, %for.body37.preheader ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp22 = icmp sgt i64 %indvars.iv.next, %indvars.iv530
br i1 %cmp22, label %for.body23, label %for.end62, !llvm.loop !12
for.end62: ; preds = %for.inc61
%indvars.iv.next531 = add nuw nsw i64 %indvars.iv530, 1
%cmp20.not = icmp eq i32 %flag.3, 0
br i1 %cmp20.not, label %while.end, label %for.cond21.preheader, !llvm.loop !13
while.end: ; preds = %for.cond21.preheader, %for.end62
%call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %bobble_s)
%13 = load i32, ptr %n, align 4, !tbaa !5
%cmp68450 = icmp sgt i32 %13, 1
br i1 %cmp68450, label %for.body70, label %for.end77
for.body70: ; preds = %while.end, %for.body70
%indvars.iv533 = phi i64 [ %indvars.iv.next534, %for.body70 ], [ 1, %while.end ]
%arrayidx72 = getelementptr inbounds [36 x [3 x i8]], ptr %bobble_s, i64 0, i64 %indvars.iv533
%call74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx72)
%indvars.iv.next534 = add nuw nsw i64 %indvars.iv533, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp68 = icmp slt i64 %indvars.iv.next534, %15
br i1 %cmp68, label %for.body70, label %for.end77, !llvm.loop !14
for.end77: ; preds = %for.body70, %while.end
%putchar = call i32 @putchar(i32 10)
%16 = load i32, ptr %n, align 4, !tbaa !5
%cmp80471 = icmp sgt i32 %16, 0
br i1 %cmp80471, label %for.body82.us.preheader, label %if.end172
for.body82.us.preheader: ; preds = %for.end77
%17 = zext i32 %16 to i64
%wide.trip.count556 = zext i32 %16 to i64
br label %for.body82.us
for.body82.us: ; preds = %for.body82.us.preheader, %for.cond79.loopexit.us
%indvars.iv553 = phi i64 [ 0, %for.body82.us.preheader ], [ %indvars.iv.next554, %for.cond79.loopexit.us ]
%indvars.iv546 = phi i64 [ 1, %for.body82.us.preheader ], [ %indvars.iv.next547, %for.cond79.loopexit.us ]
%stability.0473.us = phi i32 [ 1, %for.body82.us.preheader ], [ %stability.1.lcssa.us, %for.cond79.loopexit.us ]
%indvars.iv.next554 = add nuw nsw i64 %indvars.iv553, 1
%cmp84460.us = icmp ult i64 %indvars.iv.next554, %17
br i1 %cmp84460.us, label %for.cond87.preheader.lr.ph.us, label %for.cond79.loopexit.us
for.cond79.loopexit.us: ; preds = %for.cond87.for.inc157_crit_edge.us.us, %for.body82.us
%stability.1.lcssa.us = phi i32 [ %stability.0473.us, %for.body82.us ], [ %stability.3.lcssa.us.us, %for.cond87.for.inc157_crit_edge.us.us ]
%indvars.iv.next547 = add nuw nsw i64 %indvars.iv546, 1
%exitcond557.not = icmp eq i64 %indvars.iv.next554, %wide.trip.count556
br i1 %exitcond557.not, label %for.end162, label %for.body82.us, !llvm.loop !15
for.cond87.preheader.lr.ph.us: ; preds = %for.body82.us
%arrayidx98.us = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv553, i64 1
%arrayidx97.us = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv553
br label %for.cond87.preheader.us.us
for.cond87.preheader.us.us: ; preds = %for.cond87.for.inc157_crit_edge.us.us, %for.cond87.preheader.lr.ph.us
%indvars.iv548 = phi i64 [ %indvars.iv.next549, %for.cond87.for.inc157_crit_edge.us.us ], [ %indvars.iv546, %for.cond87.preheader.lr.ph.us ]
%stability.1462.us.us = phi i32 [ %stability.3.lcssa.us.us, %for.cond87.for.inc157_crit_edge.us.us ], [ %stability.0473.us, %for.cond87.preheader.lr.ph.us ]
%arrayidx101.us.us = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv548
%arrayidx102.us.us = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv548, i64 1
br label %for.body90.us.us
for.body90.us.us: ; preds = %for.cond87.loopexit.us.us, %for.cond87.preheader.us.us
%indvars.iv541 = phi i64 [ %indvars.iv.next542, %for.cond87.loopexit.us.us ], [ 0, %for.cond87.preheader.us.us ]
%indvars.iv536 = phi i64 [ %indvars.iv.next537, %for.cond87.loopexit.us.us ], [ 1, %for.cond87.preheader.us.us ]
%stability.2458.us.us = phi i32 [ %stability.3.lcssa.us.us, %for.cond87.loopexit.us.us ], [ %stability.1462.us.us, %for.cond87.preheader.us.us ]
%indvars.iv.next542 = add nuw nsw i64 %indvars.iv541, 1
%cmp93452.us.us = icmp ult i64 %indvars.iv.next542, %17
br i1 %cmp93452.us.us, label %for.body95.lr.ph.us.us, label %for.cond87.loopexit.us.us
for.cond87.loopexit.us.us: ; preds = %for.inc151.us.us.us, %for.body95.lr.ph.us.us, %for.body90.us.us
%stability.3.lcssa.us.us = phi i32 [ %stability.2458.us.us, %for.body90.us.us ], [ %stability.2458.us.us, %for.body95.lr.ph.us.us ], [ %stability.4.us.us.us, %for.inc151.us.us.us ]
%indvars.iv.next537 = add nuw nsw i64 %indvars.iv536, 1
%exitcond545.not = icmp eq i64 %indvars.iv.next542, %wide.trip.count556
br i1 %exitcond545.not, label %for.cond87.for.inc157_crit_edge.us.us, label %for.body90.us.us, !llvm.loop !16
for.body95.lr.ph.us.us: ; preds = %for.body90.us.us
%18 = load i8, ptr %arrayidx98.us, align 1, !tbaa !9
%19 = load i8, ptr %arrayidx102.us.us, align 1, !tbaa !9
%cmp104.us.us = icmp eq i8 %18, %19
%arrayidx122.us.us = getelementptr inbounds [36 x [3 x i8]], ptr %bobble_s, i64 0, i64 %indvars.iv541
%arrayidx145.us.us = getelementptr inbounds [36 x [3 x i8]], ptr %bobble_s, i64 0, i64 %indvars.iv541, i64 1
br i1 %cmp104.us.us, label %for.body95.lr.ph.split.us.us.us, label %for.cond87.loopexit.us.us
for.body95.lr.ph.split.us.us.us: ; preds = %for.body95.lr.ph.us.us
%20 = load i8, ptr %arrayidx97.us, align 1, !tbaa !9
br label %for.body95.us.us.us
for.body95.us.us.us: ; preds = %for.inc151.us.us.us, %for.body95.lr.ph.split.us.us.us
%indvars.iv538 = phi i64 [ %indvars.iv.next539, %for.inc151.us.us.us ], [ %indvars.iv536, %for.body95.lr.ph.split.us.us.us ]
%stability.3454.us.us.us = phi i32 [ %stability.4.us.us.us, %for.inc151.us.us.us ], [ %stability.2458.us.us, %for.body95.lr.ph.split.us.us.us ]
%arrayidx111.us.us.us = getelementptr inbounds [36 x [3 x i8]], ptr %bobble_s, i64 0, i64 %indvars.iv538
%21 = load i8, ptr %arrayidx111.us.us.us, align 1, !tbaa !9
%cmp114.us.us.us = icmp eq i8 %20, %21
br i1 %cmp114.us.us.us, label %land.lhs.true116.us.us.us, label %for.inc151.us.us.us
land.lhs.true116.us.us.us: ; preds = %for.body95.us.us.us
%22 = load i8, ptr %arrayidx101.us.us, align 1, !tbaa !9
%23 = load i8, ptr %arrayidx122.us.us, align 1, !tbaa !9
%cmp125.us.us.us = icmp eq i8 %22, %23
br i1 %cmp125.us.us.us, label %land.lhs.true127.us.us.us, label %for.inc151.us.us.us
land.lhs.true127.us.us.us: ; preds = %land.lhs.true116.us.us.us
%arrayidx134.us.us.us = getelementptr inbounds [36 x [3 x i8]], ptr %bobble_s, i64 0, i64 %indvars.iv538, i64 1
%24 = load i8, ptr %arrayidx134.us.us.us, align 1, !tbaa !9
%cmp136.us.us.us = icmp eq i8 %18, %24
br i1 %cmp136.us.us.us, label %land.lhs.true138.us.us.us, label %for.inc151.us.us.us
land.lhs.true138.us.us.us: ; preds = %land.lhs.true127.us.us.us
%25 = load i8, ptr %arrayidx145.us.us, align 1, !tbaa !9
%cmp147.us.us.us = icmp eq i8 %18, %25
%spec.select.us.us.us = select i1 %cmp147.us.us.us, i32 0, i32 %stability.3454.us.us.us
br label %for.inc151.us.us.us
for.inc151.us.us.us: ; preds = %land.lhs.true138.us.us.us, %land.lhs.true127.us.us.us, %land.lhs.true116.us.us.us, %for.body95.us.us.us
%stability.4.us.us.us = phi i32 [ %stability.3454.us.us.us, %land.lhs.true127.us.us.us ], [ %stability.3454.us.us.us, %land.lhs.true116.us.us.us ], [ %stability.3454.us.us.us, %for.body95.us.us.us ], [ %spec.select.us.us.us, %land.lhs.true138.us.us.us ]
%indvars.iv.next539 = add nuw nsw i64 %indvars.iv538, 1
%exitcond.not = icmp eq i64 %indvars.iv.next539, %wide.trip.count556
br i1 %exitcond.not, label %for.cond87.loopexit.us.us, label %for.body95.us.us.us, !llvm.loop !17
for.cond87.for.inc157_crit_edge.us.us: ; preds = %for.cond87.loopexit.us.us
%indvars.iv.next549 = add nuw nsw i64 %indvars.iv548, 1
%exitcond552.not = icmp eq i64 %indvars.iv.next549, %wide.trip.count556
br i1 %exitcond552.not, label %for.cond79.loopexit.us, label %for.cond87.preheader.us.us, !llvm.loop !18
for.end162: ; preds = %for.cond79.loopexit.us
%cmp163 = icmp eq i32 %stability.1.lcssa.us, 1
%spec.select = select i1 %cmp163, ptr @str.8, ptr @str.7
br label %if.end172
if.end172: ; preds = %for.end162, %for.end77
%str.sink = phi ptr [ @str.8, %for.end77 ], [ %spec.select, %for.end162 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%26 = load i32, ptr %n, align 4, !tbaa !5
%cmp174478 = icmp sgt i32 %26, 0
br i1 %cmp174478, label %for.cond177.preheader.preheader, label %for.end227
for.cond177.preheader.preheader: ; preds = %if.end172
%27 = zext i32 %26 to i64
%wide.trip.count569 = zext i32 %26 to i64
br label %for.cond177.preheader
for.cond177.preheader: ; preds = %for.cond177.preheader.preheader, %for.inc225
%indvars.iv558 = phi i64 [ 0, %for.cond177.preheader.preheader ], [ %indvars.iv.next559, %for.inc225 ]
%28 = trunc i64 %indvars.iv558 to i32
br label %for.body180
for.body180: ; preds = %for.cond177.preheader, %for.body180
%indvars.iv560 = phi i64 [ %indvars.iv558, %for.cond177.preheader ], [ %indvars.iv.next561, %for.body180 ]
%minj.0476 = phi i32 [ %28, %for.cond177.preheader ], [ %spec.select437, %for.body180 ]
%arrayidx183 = getelementptr inbounds [36 x [3 x i8]], ptr %selection_s, i64 0, i64 %indvars.iv560, i64 1
%29 = load i8, ptr %arrayidx183, align 1, !tbaa !9
%idxprom185 = sext i32 %minj.0476 to i64
%arrayidx187 = getelementptr inbounds [36 x [3 x i8]], ptr %selection_s, i64 0, i64 %idxprom185, i64 1
%30 = load i8, ptr %arrayidx187, align 1, !tbaa !9
%cmp189 = icmp slt i8 %29, %30
%31 = trunc i64 %indvars.iv560 to i32
%spec.select437 = select i1 %cmp189, i32 %31, i32 %minj.0476
%indvars.iv.next561 = add nuw nsw i64 %indvars.iv560, 1
%cmp178 = icmp ult i64 %indvars.iv.next561, %27
br i1 %cmp178, label %for.body180, label %for.end195, !llvm.loop !19
for.end195: ; preds = %for.body180
%32 = zext i32 %spec.select437 to i64
%cmp196.not = icmp eq i64 %indvars.iv558, %32
br i1 %cmp196.not, label %for.inc225, label %for.cond199.preheader
for.cond199.preheader: ; preds = %for.end195
%idxprom208 = sext i32 %spec.select437 to i64
%arrayidx206 = getelementptr inbounds [36 x [3 x i8]], ptr %selection_s, i64 0, i64 %indvars.iv558, i64 0
%33 = load i8, ptr %arrayidx206, align 1, !tbaa !9
%arrayidx211 = getelementptr inbounds [36 x [3 x i8]], ptr %selection_s, i64 0, i64 %idxprom208, i64 0
%34 = load i8, ptr %arrayidx211, align 1, !tbaa !9
store i8 %34, ptr %arrayidx206, align 1, !tbaa !9
store i8 %33, ptr %arrayidx211, align 1, !tbaa !9
%arrayidx206.1 = getelementptr inbounds [36 x [3 x i8]], ptr %selection_s, i64 0, i64 %indvars.iv558, i64 1
%35 = load i8, ptr %arrayidx206.1, align 1, !tbaa !9
%arrayidx211.1 = getelementptr inbounds [36 x [3 x i8]], ptr %selection_s, i64 0, i64 %idxprom208, i64 1
%36 = load i8, ptr %arrayidx211.1, align 1, !tbaa !9
store i8 %36, ptr %arrayidx206.1, align 1, !tbaa !9
store i8 %35, ptr %arrayidx211.1, align 1, !tbaa !9
br label %for.inc225
for.inc225: ; preds = %for.cond199.preheader, %for.end195
%indvars.iv.next559 = add nuw nsw i64 %indvars.iv558, 1
%exitcond570.not = icmp eq i64 %indvars.iv.next559, %wide.trip.count569
br i1 %exitcond570.not, label %for.end227, label %for.cond177.preheader, !llvm.loop !20
for.end227: ; preds = %for.inc225, %if.end172
%call230 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %selection_s)
%37 = load i32, ptr %n, align 4, !tbaa !5
%cmp232480 = icmp sgt i32 %37, 1
br i1 %cmp232480, label %for.body234, label %for.end241
for.body234: ; preds = %for.end227, %for.body234
%indvars.iv571 = phi i64 [ %indvars.iv.next572, %for.body234 ], [ 1, %for.end227 ]
%arrayidx236 = getelementptr inbounds [36 x [3 x i8]], ptr %selection_s, i64 0, i64 %indvars.iv571
%call238 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx236)
%indvars.iv.next572 = add nuw nsw i64 %indvars.iv571, 1
%38 = load i32, ptr %n, align 4, !tbaa !5
%39 = sext i32 %38 to i64
%cmp232 = icmp slt i64 %indvars.iv.next572, %39
br i1 %cmp232, label %for.body234, label %for.end241, !llvm.loop !21
for.end241: ; preds = %for.body234, %for.end227
%putchar434 = call i32 @putchar(i32 10)
%40 = load i32, ptr %n, align 4, !tbaa !5
%cmp244502 = icmp sgt i32 %40, 0
br i1 %cmp244502, label %for.body246.us.preheader, label %if.end339
for.body246.us.preheader: ; preds = %for.end241
%41 = zext i32 %40 to i64
%wide.trip.count596 = zext i32 %40 to i64
br label %for.body246.us
for.body246.us: ; preds = %for.body246.us.preheader, %for.cond243.loopexit.us
%indvars.iv593 = phi i64 [ 0, %for.body246.us.preheader ], [ %indvars.iv.next594, %for.cond243.loopexit.us ]
%indvars.iv586 = phi i64 [ 1, %for.body246.us.preheader ], [ %indvars.iv.next587, %for.cond243.loopexit.us ]
%stability.5504.us = phi i32 [ 1, %for.body246.us.preheader ], [ %stability.6.lcssa.us, %for.cond243.loopexit.us ]
%indvars.iv.next594 = add nuw nsw i64 %indvars.iv593, 1
%cmp249491.us = icmp ult i64 %indvars.iv.next594, %41
br i1 %cmp249491.us, label %for.cond252.preheader.lr.ph.us, label %for.cond243.loopexit.us
for.cond243.loopexit.us: ; preds = %for.cond252.for.inc323_crit_edge.us.us, %for.body246.us
%stability.6.lcssa.us = phi i32 [ %stability.5504.us, %for.body246.us ], [ %stability.8.lcssa.us.us, %for.cond252.for.inc323_crit_edge.us.us ]
%indvars.iv.next587 = add nuw nsw i64 %indvars.iv586, 1
%exitcond597.not = icmp eq i64 %indvars.iv.next594, %wide.trip.count596
br i1 %exitcond597.not, label %for.end328, label %for.body246.us, !llvm.loop !22
for.cond252.preheader.lr.ph.us: ; preds = %for.body246.us
%arrayidx263.us = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv593, i64 1
%arrayidx262.us = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv593
br label %for.cond252.preheader.us.us
for.cond252.preheader.us.us: ; preds = %for.cond252.for.inc323_crit_edge.us.us, %for.cond252.preheader.lr.ph.us
%indvars.iv588 = phi i64 [ %indvars.iv.next589, %for.cond252.for.inc323_crit_edge.us.us ], [ %indvars.iv586, %for.cond252.preheader.lr.ph.us ]
%stability.6493.us.us = phi i32 [ %stability.8.lcssa.us.us, %for.cond252.for.inc323_crit_edge.us.us ], [ %stability.5504.us, %for.cond252.preheader.lr.ph.us ]
%arrayidx266.us.us = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv588
%arrayidx267.us.us = getelementptr inbounds [36 x [3 x i8]], ptr %s, i64 0, i64 %indvars.iv588, i64 1
br label %for.body255.us.us
for.body255.us.us: ; preds = %for.cond252.loopexit.us.us, %for.cond252.preheader.us.us
%indvars.iv581 = phi i64 [ %indvars.iv.next582, %for.cond252.loopexit.us.us ], [ 0, %for.cond252.preheader.us.us ]
%indvars.iv574 = phi i64 [ %indvars.iv.next575, %for.cond252.loopexit.us.us ], [ 1, %for.cond252.preheader.us.us ]
%stability.7489.us.us = phi i32 [ %stability.8.lcssa.us.us, %for.cond252.loopexit.us.us ], [ %stability.6493.us.us, %for.cond252.preheader.us.us ]
%indvars.iv.next582 = add nuw nsw i64 %indvars.iv581, 1
%cmp258482.us.us = icmp ult i64 %indvars.iv.next582, %41
br i1 %cmp258482.us.us, label %for.body260.lr.ph.us.us, label %for.cond252.loopexit.us.us
for.cond252.loopexit.us.us: ; preds = %for.inc317.us.us.us, %for.body260.lr.ph.us.us, %for.body255.us.us
%stability.8.lcssa.us.us = phi i32 [ %stability.7489.us.us, %for.body255.us.us ], [ %stability.7489.us.us, %for.body260.lr.ph.us.us ], [ %stability.9.us.us.us, %for.inc317.us.us.us ]
%indvars.iv.next575 = add nuw nsw i64 %indvars.iv574, 1
%exitcond585.not = icmp eq i64 %indvars.iv.next582, %wide.trip.count596
br i1 %exitcond585.not, label %for.cond252.for.inc323_crit_edge.us.us, label %for.body255.us.us, !llvm.loop !23
for.body260.lr.ph.us.us: ; preds = %for.body255.us.us
%42 = load i8, ptr %arrayidx263.us, align 1, !tbaa !9
%43 = load i8, ptr %arrayidx267.us.us, align 1, !tbaa !9
%cmp269.us.us = icmp eq i8 %42, %43
%arrayidx288.us.us = getelementptr inbounds [36 x [3 x i8]], ptr %selection_s, i64 0, i64 %indvars.iv581
%arrayidx311.us.us = getelementptr inbounds [36 x [3 x i8]], ptr %bobble_s, i64 0, i64 %indvars.iv581, i64 1
br i1 %cmp269.us.us, label %for.body260.lr.ph.split.us.us.us, label %for.cond252.loopexit.us.us
for.body260.lr.ph.split.us.us.us: ; preds = %for.body260.lr.ph.us.us
%44 = load i8, ptr %arrayidx262.us, align 1, !tbaa !9
br label %for.body260.us.us.us
for.body260.us.us.us: ; preds = %for.inc317.us.us.us, %for.body260.lr.ph.split.us.us.us
%indvars.iv576 = phi i64 [ %indvars.iv.next577, %for.inc317.us.us.us ], [ %indvars.iv574, %for.body260.lr.ph.split.us.us.us ]
%stability.8484.us.us.us = phi i32 [ %stability.9.us.us.us, %for.inc317.us.us.us ], [ %stability.7489.us.us, %for.body260.lr.ph.split.us.us.us ]
%arrayidx277.us.us.us = getelementptr inbounds [36 x [3 x i8]], ptr %selection_s, i64 0, i64 %indvars.iv576
%45 = load i8, ptr %arrayidx277.us.us.us, align 1, !tbaa !9
%cmp280.us.us.us = icmp eq i8 %44, %45
br i1 %cmp280.us.us.us, label %land.lhs.true282.us.us.us, label %for.inc317.us.us.us
land.lhs.true282.us.us.us: ; preds = %for.body260.us.us.us
%46 = load i8, ptr %arrayidx266.us.us, align 1, !tbaa !9
%47 = load i8, ptr %arrayidx288.us.us, align 1, !tbaa !9
%cmp291.us.us.us = icmp eq i8 %46, %47
br i1 %cmp291.us.us.us, label %land.lhs.true293.us.us.us, label %for.inc317.us.us.us
land.lhs.true293.us.us.us: ; preds = %land.lhs.true282.us.us.us
%arrayidx300.us.us.us = getelementptr inbounds [36 x [3 x i8]], ptr %bobble_s, i64 0, i64 %indvars.iv576, i64 1
%48 = load i8, ptr %arrayidx300.us.us.us, align 1, !tbaa !9
%cmp302.us.us.us = icmp eq i8 %42, %48
br i1 %cmp302.us.us.us, label %land.lhs.true304.us.us.us, label %for.inc317.us.us.us
land.lhs.true304.us.us.us: ; preds = %land.lhs.true293.us.us.us
%49 = load i8, ptr %arrayidx311.us.us, align 1, !tbaa !9
%cmp313.us.us.us = icmp eq i8 %42, %49
%spec.select438.us.us.us = select i1 %cmp313.us.us.us, i32 0, i32 %stability.8484.us.us.us
br label %for.inc317.us.us.us
for.inc317.us.us.us: ; preds = %land.lhs.true304.us.us.us, %land.lhs.true293.us.us.us, %land.lhs.true282.us.us.us, %for.body260.us.us.us
%stability.9.us.us.us = phi i32 [ %stability.8484.us.us.us, %land.lhs.true293.us.us.us ], [ %stability.8484.us.us.us, %land.lhs.true282.us.us.us ], [ %stability.8484.us.us.us, %for.body260.us.us.us ], [ %spec.select438.us.us.us, %land.lhs.true304.us.us.us ]
%indvars.iv.next577 = add nuw nsw i64 %indvars.iv576, 1
%exitcond580.not = icmp eq i64 %indvars.iv.next577, %wide.trip.count596
br i1 %exitcond580.not, label %for.cond252.loopexit.us.us, label %for.body260.us.us.us, !llvm.loop !24
for.cond252.for.inc323_crit_edge.us.us: ; preds = %for.cond252.loopexit.us.us
%indvars.iv.next589 = add nuw nsw i64 %indvars.iv588, 1
%exitcond592.not = icmp eq i64 %indvars.iv.next589, %wide.trip.count596
br i1 %exitcond592.not, label %for.cond243.loopexit.us, label %for.cond252.preheader.us.us, !llvm.loop !25
for.end328: ; preds = %for.cond243.loopexit.us
%50 = icmp eq i32 %stability.6.lcssa.us, 1
%spec.select606 = select i1 %50, ptr @str.8, ptr @str.7
br label %if.end339
if.end339: ; preds = %for.end328, %for.end241
%str.7.sink = phi ptr [ @str.8, %for.end241 ], [ %spec.select606, %for.end328 ]
%puts435 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %selection_s) #5
call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %bobble_s) #5
call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11}
!23 = distinct !{!23, !11}
!24 = distinct !{!24, !11}
!25 = distinct !{!25, !11}
|
#include <stdio.h>
#include <string.h>
int main(){
int i,j,n,flag=1,min;
char a[36][3],b[36][3],r1[3],r2[3];
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%s",a[i]);
for(j=0; j<3; j++)
b[i][j]=a[i][j];
}
/* Babble */
while(flag){
flag=0;
for(i=n-1; i>0; i--){
if(a[i][1]<a[i-1][1]){
strcpy(r1,a[i]);
strcpy(a[i],a[i-1]);
strcpy(a[i-1],r1);
flag=1;
}
}
}
for(i=0; i<n-1; i++)
printf("%s ",a[i]);
printf("%s\n",a[i]);
printf("Stable\n");
/* Selection */
for(i=0; i<n; i++){
min = i;
for(j=i; j<n; j++)
if(b[j][1]<b[min][1])
min = j;
if(i!=min){
strcpy(r2,b[i]);
strcpy(b[i],b[min]);
strcpy(b[min],r2);
}
}
for(i=0; i<n-1; i++)
printf("%s ",b[i]);
printf("%s\n",b[i]);
flag=0;
for(i=0; i<n; i++)
if(a[i][0]!=b[i][0])
flag=1;
if(flag==0)
printf("Stable\n");
else
printf("Not stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114223/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114223/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%s \00", align 1
@str.6 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [36 x [3 x i8]], align 16
%b = alloca [36 x [3 x i8]], align 16
%r1 = alloca [3 x i8], align 1
%r2 = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %b) #6
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %r1) #6
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %r2) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp203 = icmp sgt i32 %0, 0
br i1 %cmp203, label %for.body, label %for.end61
while.cond.preheader: ; preds = %for.body
%cmp17206 = icmp sgt i32 %5, 1
br i1 %cmp17206, label %for.cond16.preheader.us.preheader, label %for.end61
for.cond16.preheader.us.preheader: ; preds = %while.cond.preheader
%1 = zext i32 %5 to i64
br label %for.body18.us
for.body18.us: ; preds = %for.body18.us.backedge, %for.cond16.preheader.us.preheader
%indvars.iv = phi i64 [ %1, %for.cond16.preheader.us.preheader ], [ %indvars.iv.be, %for.body18.us.backedge ]
%flag.1208.us = phi i32 [ 0, %for.cond16.preheader.us.preheader ], [ %flag.1208.us.be, %for.body18.us.backedge ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%idxprom19.us = and i64 %indvars.iv.next, 4294967295
%arrayidx21.us = getelementptr inbounds [36 x [3 x i8]], ptr %a, i64 0, i64 %idxprom19.us, i64 1
%2 = load i8, ptr %arrayidx21.us, align 1, !tbaa !9
%sub22.us = add i64 %indvars.iv, 4294967294
%idxprom23.us = and i64 %sub22.us, 4294967295
%arrayidx25.us = getelementptr inbounds [36 x [3 x i8]], ptr %a, i64 0, i64 %idxprom23.us, i64 1
%3 = load i8, ptr %arrayidx25.us, align 1, !tbaa !9
%cmp27.us = icmp slt i8 %2, %3
br i1 %cmp27.us, label %if.then.us, label %for.inc48.us
if.then.us: ; preds = %for.body18.us
%arrayidx24.us = getelementptr inbounds [36 x [3 x i8]], ptr %a, i64 0, i64 %idxprom23.us
%arrayidx20.us = getelementptr inbounds [36 x [3 x i8]], ptr %a, i64 0, i64 %idxprom19.us
%call33.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %r1, ptr noundef nonnull dereferenceable(1) %arrayidx20.us) #6
%call41.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx20.us, ptr noundef nonnull dereferenceable(1) %arrayidx24.us) #6
%call47.us = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx24.us, ptr noundef nonnull dereferenceable(1) %r1) #6
br label %for.inc48.us
for.inc48.us: ; preds = %if.then.us, %for.body18.us
%flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.1208.us, %for.body18.us ]
%cmp17.us = icmp sgt i64 %indvars.iv, 2
br i1 %cmp17.us, label %for.body18.us.backedge, label %for.cond16.while.cond.loopexit_crit_edge.us
for.body18.us.backedge: ; preds = %for.inc48.us, %for.cond16.while.cond.loopexit_crit_edge.us
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc48.us ], [ %1, %for.cond16.while.cond.loopexit_crit_edge.us ]
%flag.1208.us.be = phi i32 [ %flag.2.us, %for.inc48.us ], [ 0, %for.cond16.while.cond.loopexit_crit_edge.us ]
br label %for.body18.us, !llvm.loop !10
for.cond16.while.cond.loopexit_crit_edge.us: ; preds = %for.inc48.us
%tobool.not.us = icmp eq i32 %flag.2.us, 0
br i1 %tobool.not.us, label %for.cond50.preheader, label %for.body18.us.backedge
for.body: ; preds = %entry, %for.body
%indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
%4 = mul nuw nsw i64 %indvar, 3
%scevgep = getelementptr i8, ptr %b, i64 %4
%scevgep228 = getelementptr i8, ptr %a, i64 %4
%arrayidx = getelementptr inbounds [36 x [3 x i8]], ptr %a, i64 0, i64 %indvar
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %scevgep, ptr noundef nonnull align 1 dereferenceable(3) %scevgep228, i64 3, i1 false), !tbaa !9
%indvar.next = add nuw nsw i64 %indvar, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvar.next, %6
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !12
for.cond50.preheader: ; preds = %for.cond16.while.cond.loopexit_crit_edge.us
br i1 %cmp17206, label %for.body54, label %for.end61
for.body54: ; preds = %for.cond50.preheader, %for.body54
%indvars.iv232 = phi i64 [ %indvars.iv.next233, %for.body54 ], [ 0, %for.cond50.preheader ]
%arrayidx56 = getelementptr inbounds [36 x [3 x i8]], ptr %a, i64 0, i64 %indvars.iv232
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx56)
%indvars.iv.next233 = add nuw nsw i64 %indvars.iv232, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%sub51 = add nsw i32 %7, -1
%8 = sext i32 %sub51 to i64
%cmp52 = icmp slt i64 %indvars.iv.next233, %8
br i1 %cmp52, label %for.body54, label %for.end61.loopexit, !llvm.loop !13
for.end61.loopexit: ; preds = %for.body54
%9 = and i64 %indvars.iv.next233, 4294967295
br label %for.end61
for.end61: ; preds = %entry, %while.cond.preheader, %for.end61.loopexit, %for.cond50.preheader
%i.2.lcssa = phi i64 [ 0, %for.cond50.preheader ], [ %9, %for.end61.loopexit ], [ 0, %while.cond.preheader ], [ 0, %entry ]
%arrayidx63 = getelementptr inbounds [36 x [3 x i8]], ptr %a, i64 0, i64 %i.2.lcssa
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx63)
%puts197 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%10 = load i32, ptr %n, align 4, !tbaa !5
%cmp68217 = icmp sgt i32 %10, 0
br i1 %cmp68217, label %for.cond71.preheader.preheader, label %for.end125
for.cond71.preheader.preheader: ; preds = %for.end61
%11 = zext i32 %10 to i64
%wide.trip.count = zext i32 %10 to i64
br label %for.cond71.preheader
for.cond71.preheader: ; preds = %for.cond71.preheader.preheader, %for.inc111
%indvars.iv236 = phi i64 [ 0, %for.cond71.preheader.preheader ], [ %indvars.iv.next237, %for.inc111 ]
%12 = trunc i64 %indvars.iv236 to i32
br label %for.body74
for.cond114.preheader: ; preds = %for.inc111
%cmp116220 = icmp sgt i32 %10, 1
br i1 %cmp116220, label %for.body118, label %for.end125
for.body74: ; preds = %for.cond71.preheader, %for.body74
%indvars.iv238 = phi i64 [ %indvars.iv236, %for.cond71.preheader ], [ %indvars.iv.next239, %for.body74 ]
%min.0216 = phi i32 [ %12, %for.cond71.preheader ], [ %spec.select, %for.body74 ]
%arrayidx77 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %indvars.iv238, i64 1
%13 = load i8, ptr %arrayidx77, align 1, !tbaa !9
%idxprom79 = sext i32 %min.0216 to i64
%arrayidx81 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %idxprom79, i64 1
%14 = load i8, ptr %arrayidx81, align 1, !tbaa !9
%cmp83 = icmp slt i8 %13, %14
%15 = trunc i64 %indvars.iv238 to i32
%spec.select = select i1 %cmp83, i32 %15, i32 %min.0216
%indvars.iv.next239 = add nuw nsw i64 %indvars.iv238, 1
%cmp72 = icmp ult i64 %indvars.iv.next239, %11
br i1 %cmp72, label %for.body74, label %for.end89, !llvm.loop !14
for.end89: ; preds = %for.body74
%16 = zext i32 %spec.select to i64
%cmp90.not = icmp eq i64 %indvars.iv236, %16
br i1 %cmp90.not, label %for.inc111, label %if.then92
if.then92: ; preds = %for.end89
%arrayidx95 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %indvars.iv236
%call97 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %r2, ptr noundef nonnull dereferenceable(1) %arrayidx95) #6
%idxprom101 = sext i32 %spec.select to i64
%arrayidx102 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %idxprom101
%call104 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx95, ptr noundef nonnull dereferenceable(1) %arrayidx102) #6
%call109 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx102, ptr noundef nonnull dereferenceable(1) %r2) #6
br label %for.inc111
for.inc111: ; preds = %for.end89, %if.then92
%indvars.iv.next237 = add nuw nsw i64 %indvars.iv236, 1
%exitcond.not = icmp eq i64 %indvars.iv.next237, %wide.trip.count
br i1 %exitcond.not, label %for.cond114.preheader, label %for.cond71.preheader, !llvm.loop !15
for.body118: ; preds = %for.cond114.preheader, %for.body118
%indvars.iv244 = phi i64 [ %indvars.iv.next245, %for.body118 ], [ 0, %for.cond114.preheader ]
%arrayidx120 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %indvars.iv244
%call122 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx120)
%indvars.iv.next245 = add nuw nsw i64 %indvars.iv244, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%sub115 = add nsw i32 %17, -1
%18 = sext i32 %sub115 to i64
%cmp116 = icmp slt i64 %indvars.iv.next245, %18
br i1 %cmp116, label %for.body118, label %for.end125.loopexit, !llvm.loop !16
for.end125.loopexit: ; preds = %for.body118
%19 = and i64 %indvars.iv.next245, 4294967295
br label %for.end125
for.end125: ; preds = %for.end61, %for.end125.loopexit, %for.cond114.preheader
%i.4.lcssa = phi i64 [ 0, %for.cond114.preheader ], [ %19, %for.end125.loopexit ], [ 0, %for.end61 ]
%arrayidx127 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %i.4.lcssa
%puts198 = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx127)
%20 = load i32, ptr %n, align 4, !tbaa !5
%cmp131223 = icmp sgt i32 %20, 0
br i1 %cmp131223, label %for.body133.preheader, label %if.end154
for.body133.preheader: ; preds = %for.end125
%wide.trip.count252 = zext i32 %20 to i64
%xtraiter = and i64 %wide.trip.count252, 1
%21 = icmp eq i32 %20, 1
br i1 %21, label %for.end148.unr-lcssa, label %for.body133.preheader.new
for.body133.preheader.new: ; preds = %for.body133.preheader
%unroll_iter = and i64 %wide.trip.count252, 4294967294
br label %for.body133
for.body133: ; preds = %for.body133, %for.body133.preheader.new
%indvars.iv248 = phi i64 [ 0, %for.body133.preheader.new ], [ %indvars.iv.next249.1, %for.body133 ]
%flag.3225 = phi i32 [ 0, %for.body133.preheader.new ], [ %spec.select201.1, %for.body133 ]
%niter = phi i64 [ 0, %for.body133.preheader.new ], [ %niter.next.1, %for.body133 ]
%arrayidx135 = getelementptr inbounds [36 x [3 x i8]], ptr %a, i64 0, i64 %indvars.iv248
%22 = load i8, ptr %arrayidx135, align 2, !tbaa !9
%arrayidx139 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %indvars.iv248
%23 = load i8, ptr %arrayidx139, align 2, !tbaa !9
%cmp142.not = icmp eq i8 %22, %23
%indvars.iv.next249 = or i64 %indvars.iv248, 1
%arrayidx135.1 = getelementptr inbounds [36 x [3 x i8]], ptr %a, i64 0, i64 %indvars.iv.next249
%24 = load i8, ptr %arrayidx135.1, align 1, !tbaa !9
%arrayidx139.1 = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %indvars.iv.next249
%25 = load i8, ptr %arrayidx139.1, align 1, !tbaa !9
%cmp142.not.1 = icmp eq i8 %24, %25
%26 = select i1 %cmp142.not.1, i1 %cmp142.not, i1 false
%spec.select201.1 = select i1 %26, i32 %flag.3225, i32 1
%indvars.iv.next249.1 = add nuw nsw i64 %indvars.iv248, 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.end148.unr-lcssa, label %for.body133, !llvm.loop !17
for.end148.unr-lcssa: ; preds = %for.body133, %for.body133.preheader
%spec.select201.lcssa.ph = phi i32 [ undef, %for.body133.preheader ], [ %spec.select201.1, %for.body133 ]
%indvars.iv248.unr = phi i64 [ 0, %for.body133.preheader ], [ %indvars.iv.next249.1, %for.body133 ]
%flag.3225.unr = phi i32 [ 0, %for.body133.preheader ], [ %spec.select201.1, %for.body133 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end148, label %for.body133.epil
for.body133.epil: ; preds = %for.end148.unr-lcssa
%arrayidx135.epil = getelementptr inbounds [36 x [3 x i8]], ptr %a, i64 0, i64 %indvars.iv248.unr
%27 = load i8, ptr %arrayidx135.epil, align 1, !tbaa !9
%arrayidx139.epil = getelementptr inbounds [36 x [3 x i8]], ptr %b, i64 0, i64 %indvars.iv248.unr
%28 = load i8, ptr %arrayidx139.epil, align 1, !tbaa !9
%cmp142.not.epil = icmp eq i8 %27, %28
%spec.select201.epil = select i1 %cmp142.not.epil, i32 %flag.3225.unr, i32 1
br label %for.end148
for.end148: ; preds = %for.end148.unr-lcssa, %for.body133.epil
%spec.select201.lcssa = phi i32 [ %spec.select201.lcssa.ph, %for.end148.unr-lcssa ], [ %spec.select201.epil, %for.body133.epil ]
%29 = icmp eq i32 %spec.select201.lcssa, 0
%spec.select259 = select i1 %29, ptr @str.7, ptr @str.6
br label %if.end154
if.end154: ; preds = %for.end148, %for.end125
%str.6.sink = phi ptr [ @str.7, %for.end125 ], [ %spec.select259, %for.end148 ]
%puts199 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %r2) #6
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %r1) #6
call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
|
#include<stdio.h>
#include<string.h>
int N,M,P,m[8][8][8],x,y,i,j,h,r,p,C[14];
int dfs(int px,int py,int ph,int mx,int my,int mh,int P)
{
if(0>px||px>N||0>py||py>N||0>ph||ph>N||m[px][py][ph]!=P)
return 0;
return dfs(px+mx,py+my,ph+mh,mx,my,mh,P)+1;
}
int main()
{
for(;scanf("%d%d%d",&N,&M,&P),N;)
{
memset(m,0,sizeof(m));
for(i=r=0,p=1;i<P;i++,p*=-1)
{
memset(C,0,sizeof(C));
scanf("%d%d",&x,&y);
x--;y--;
for(h=0;m[x][y][h];h++);
m[x][y][h]=p;
if(r!=0)continue;
C[0]=dfs(x,y,h,0,0,-1,p)+dfs(x,y,h,0,0,1,p)-1;
C[1]=dfs(x,y,h,0,-1,0,p)+dfs(x,y,h,0,1,0,p)-1;
C[2]=dfs(x,y,h,-1,0,0,p)+dfs(x,y,h,1,0,0,p)-1;
C[3]=dfs(x,y,h,0,-1,-1,p)+dfs(x,y,h,0,1,1,p)-1;
C[4]=dfs(x,y,h,0,1,-1,p)+dfs(x,y,h,0,-1,1,p)-1;
C[5]=dfs(x,y,h,-1,0,-1,p)+dfs(x,y,h,1,0,1,p)-1;
C[6]=dfs(x,y,h,1,0,-1,p)+dfs(x,y,h,-1,0,1,p)-1;
C[7]=dfs(x,y,h,-1,-1,0,p)+dfs(x,y,h,1,1,0,p)-1;
C[8]=dfs(x,y,h,1,-1,0,p)+dfs(x,y,h,-1,1,0,p)-1;
C[9]=dfs(x,y,h,-1,-1,-1,p)+dfs(x,y,h,1,1,1,p)-1;
C[10]=dfs(x,y,h,1,-1,1,p)+dfs(x,y,h,-1,1,-1,p)-1;
C[11]=dfs(x,y,h,-1,-1,1,p)+dfs(x,y,h,1,1,-1,p)-1;
C[12]=dfs(x,y,h,1,-1,-1,p)+dfs(x,y,h,-1,1,1,p)-1;
for(j=0;j<13;j++)
if(C[j]>=M)
r=i;
}
printf("%s",r==0?"Draw":r%2?"White":"Black");
if(r==0)
puts("");
else
printf(" %d\n",r+1);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114281/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114281/source.c"
target datalayout = "e-m:e-p270: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 [8 x [8 x [8 x i32]]] zeroinitializer, align 16
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@M = dso_local global i32 0, align 4
@P = dso_local global i32 0, align 4
@r = dso_local local_unnamed_addr global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@p = dso_local local_unnamed_addr global i32 0, align 4
@C = dso_local local_unnamed_addr global [14 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@x = dso_local global i32 0, align 4
@y = dso_local global i32 0, align 4
@h = dso_local local_unnamed_addr global i32 0, align 4
@j = dso_local local_unnamed_addr global i32 0, align 4
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"Draw\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"White\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"Black\00", align 1
@.str.7 = private unnamed_addr constant [5 x i8] c" %d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @dfs(i32 noundef %px, i32 noundef %py, i32 noundef %ph, i32 noundef %mx, i32 noundef %my, i32 noundef %mh, i32 noundef %P) local_unnamed_addr #0 {
entry:
%cmp34 = icmp slt i32 %px, 0
br i1 %cmp34, label %return, label %lor.lhs.false.lr.ph
lor.lhs.false.lr.ph: ; preds = %entry
%0 = load i32, ptr @N, align 4, !tbaa !5
br label %lor.lhs.false
lor.lhs.false: ; preds = %lor.lhs.false.lr.ph, %if.end
%ph.tr38 = phi i32 [ %ph, %lor.lhs.false.lr.ph ], [ %add17, %if.end ]
%py.tr37 = phi i32 [ %py, %lor.lhs.false.lr.ph ], [ %add16, %if.end ]
%px.tr36 = phi i32 [ %px, %lor.lhs.false.lr.ph ], [ %add, %if.end ]
%accumulator.tr35 = phi i32 [ 0, %lor.lhs.false.lr.ph ], [ %add18, %if.end ]
%cmp1 = icmp slt i32 %0, %px.tr36
%cmp3 = icmp slt i32 %py.tr37, 0
%or.cond = or i1 %cmp3, %cmp1
br i1 %or.cond, label %return, label %lor.lhs.false4
lor.lhs.false4: ; preds = %lor.lhs.false
%cmp5 = icmp slt i32 %0, %py.tr37
%cmp7 = icmp slt i32 %ph.tr38, 0
%or.cond19 = or i1 %cmp7, %cmp5
%cmp9 = icmp slt i32 %0, %ph.tr38
%or.cond33 = or i1 %cmp9, %or.cond19
br i1 %or.cond33, label %return, label %lor.lhs.false10
lor.lhs.false10: ; preds = %lor.lhs.false4
%idxprom = zext i32 %px.tr36 to i64
%idxprom11 = zext i32 %py.tr37 to i64
%idxprom13 = zext i32 %ph.tr38 to i64
%arrayidx14 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom, i64 %idxprom11, i64 %idxprom13
%1 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15.not = icmp eq i32 %1, %P
br i1 %cmp15.not, label %if.end, label %return
if.end: ; preds = %lor.lhs.false10
%add = add nsw i32 %px.tr36, %mx
%add16 = add nsw i32 %py.tr37, %my
%add17 = add nsw i32 %ph.tr38, %mh
%add18 = add nuw nsw i32 %accumulator.tr35, 1
%cmp = icmp slt i32 %add, 0
br i1 %cmp, label %return, label %lor.lhs.false
return: ; preds = %lor.lhs.false10, %lor.lhs.false4, %lor.lhs.false, %if.end, %entry
%accumulator.tr.lcssa = phi i32 [ 0, %entry ], [ %add18, %if.end ], [ %accumulator.tr35, %lor.lhs.false ], [ %accumulator.tr35, %lor.lhs.false4 ], [ %accumulator.tr35, %lor.lhs.false10 ]
ret i32 %accumulator.tr.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call1034 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N, ptr noundef nonnull @M, ptr noundef nonnull @P)
%0 = load i32, ptr @N, align 4, !tbaa !5
%tobool.not1035 = icmp eq i32 %0, 0
br i1 %tobool.not1035, label %for.end93, label %for.body
for.body: ; preds = %entry, %if.end92
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2048) @m, i8 0, i64 2048, i1 false)
store i32 0, ptr @r, align 4, !tbaa !5
store i32 0, ptr @i, align 4, !tbaa !5
store i32 1, ptr @p, align 4, !tbaa !5
%1 = load i32, ptr @P, align 4, !tbaa !5
%cmp1033 = icmp sgt i32 %1, 0
br i1 %cmp1033, label %for.body2, label %for.end82.thread
for.body2: ; preds = %for.body, %for.inc80
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(56) @C, i8 0, i64 56, i1 false)
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @x, ptr noundef nonnull @y)
%2 = load i32, ptr @x, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr @x, align 4, !tbaa !5
%3 = load i32, ptr @y, align 4, !tbaa !5
%.fr = freeze i32 %3
%dec4 = add nsw i32 %.fr, -1
store i32 %dec4, ptr @y, align 4, !tbaa !5
%idxprom = sext i32 %dec to i64
%idxprom6 = sext i32 %dec4 to i64
br label %for.cond5
for.cond5: ; preds = %for.cond5, %for.body2
%indvars.iv1064 = phi i32 [ %indvars.iv.next1065, %for.cond5 ], [ 0, %for.body2 ]
%indvars.iv1056 = phi i32 [ %indvars.iv.next1057, %for.cond5 ], [ 1, %for.body2 ]
%indvars.iv1052 = phi i32 [ %indvars.iv.next1053, %for.cond5 ], [ 1, %for.body2 ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond5 ], [ 0, %for.body2 ]
%arrayidx9 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom, i64 %idxprom6, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%tobool10.not = icmp eq i32 %4, 0
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next1053 = add nuw i32 %indvars.iv1052, 1
%indvars.iv.next1057 = add nsw i32 %indvars.iv1056, -1
%indvars.iv.next1065 = add nuw i32 %indvars.iv1064, 1
br i1 %tobool10.not, label %for.end, label %for.cond5, !llvm.loop !9
for.end: ; preds = %for.cond5
%5 = trunc i64 %indvars.iv to i32
store i32 %5, ptr @h, align 4, !tbaa !5
%6 = load i32, ptr @p, align 4, !tbaa !5
store i32 %6, ptr %arrayidx9, align 4, !tbaa !5
%7 = load i32, ptr @r, align 4, !tbaa !5
%cmp18.not = icmp eq i32 %7, 0
br i1 %cmp18.not, label %if.end, label %for.end.for.inc80_crit_edge
for.end.for.inc80_crit_edge: ; preds = %for.end
%.pre1146 = load i32, ptr @i, align 4, !tbaa !5
br label %for.inc80
if.end: ; preds = %for.end
%cmp34.i = icmp slt i32 %2, 1
br i1 %cmp34.i, label %dfs.exit123.thread, label %lor.lhs.false.lr.ph.i
lor.lhs.false.lr.ph.i: ; preds = %if.end
%8 = load i32, ptr @N, align 4, !tbaa !5
%idxprom.i = zext i32 %dec to i64
%idxprom11.i = zext i32 %dec4 to i64
%cmp1.i = icmp slt i32 %8, %dec
%cmp1.i129.fr = freeze i1 %cmp1.i
%cmp3.i = icmp slt i32 %.fr, 1
%or.cond.i = or i1 %cmp3.i, %cmp1.i129.fr
br i1 %or.cond.i, label %dfs.exit123, label %lor.lhs.false4.i.lr.ph
lor.lhs.false4.i.lr.ph: ; preds = %lor.lhs.false.lr.ph.i
%cmp5.i = icmp slt i32 %8, %dec4
%cmp5.i.fr = freeze i1 %cmp5.i
%cmp9.i903 = icmp slt i32 %8, %5
%or.cond1249 = select i1 %cmp5.i.fr, i1 true, i1 %cmp9.i903
br i1 %or.cond1249, label %lor.lhs.false4.i106.lr.ph, label %lor.lhs.false10.i
lor.lhs.false10.i: ; preds = %lor.lhs.false4.i.lr.ph, %if.end.i
%ph.tr38.i893905 = phi i32 [ %add17.i, %if.end.i ], [ %5, %lor.lhs.false4.i.lr.ph ]
%accumulator.tr35.i894904 = phi i32 [ %add18.i, %if.end.i ], [ 0, %lor.lhs.false4.i.lr.ph ]
%idxprom13.i = zext i32 %ph.tr38.i893905 to i64
%arrayidx14.i = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i, i64 %idxprom11.i, i64 %idxprom13.i
%9 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%cmp15.not.i = icmp eq i32 %9, %6
br i1 %cmp15.not.i, label %if.end.i, label %dfs.exit
if.end.i: ; preds = %lor.lhs.false10.i
%add17.i = add nsw i32 %ph.tr38.i893905, -1
%add18.i = add nuw i32 %accumulator.tr35.i894904, 1
%exitcond = icmp eq i32 %add18.i, %indvars.iv1052
br i1 %exitcond, label %dfs.exit, label %lor.lhs.false10.i
dfs.exit: ; preds = %if.end.i, %lor.lhs.false10.i
%accumulator.tr35.i.lcssa = phi i32 [ %accumulator.tr35.i894904, %lor.lhs.false10.i ], [ %indvars.iv1052, %if.end.i ]
br i1 %or.cond.i, label %dfs.exit123, label %lor.lhs.false4.i106.lr.ph
lor.lhs.false4.i106.lr.ph: ; preds = %lor.lhs.false4.i.lr.ph, %dfs.exit
%accumulator.tr35.i.lcssa1151 = phi i32 [ %accumulator.tr35.i.lcssa, %dfs.exit ], [ 0, %lor.lhs.false4.i.lr.ph ]
%cmp5.i107 = icmp slt i32 %8, %dec4
%cmp5.i107.fr = freeze i1 %cmp5.i107
%cmp9.i110918 = icmp slt i32 %8, %5
%or.cond1250 = select i1 %cmp5.i107.fr, i1 true, i1 %cmp9.i110918
br i1 %or.cond1250, label %dfs.exit123, label %lor.lhs.false10.i112.preheader
lor.lhs.false10.i112.preheader: ; preds = %lor.lhs.false4.i106.lr.ph
%10 = add i32 %8, %indvars.iv1056
br label %lor.lhs.false10.i112
lor.lhs.false10.i112: ; preds = %lor.lhs.false10.i112.preheader, %if.end.i119
%indvars.iv1054 = phi i64 [ %indvars.iv, %lor.lhs.false10.i112.preheader ], [ %indvars.iv.next1055, %if.end.i119 ]
%accumulator.tr35.i102907919 = phi i32 [ 0, %lor.lhs.false10.i112.preheader ], [ %add18.i121, %if.end.i119 ]
%arrayidx14.i116 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i, i64 %idxprom11.i, i64 %indvars.iv1054
%11 = load i32, ptr %arrayidx14.i116, align 4, !tbaa !5
%cmp15.not.i117 = icmp eq i32 %11, %6
br i1 %cmp15.not.i117, label %if.end.i119, label %dfs.exit123
if.end.i119: ; preds = %lor.lhs.false10.i112
%indvars.iv.next1055 = add nuw i64 %indvars.iv1054, 1
%add18.i121 = add nuw i32 %accumulator.tr35.i102907919, 1
%exitcond1059.not = icmp eq i32 %add18.i121, %10
br i1 %exitcond1059.not, label %dfs.exit123, label %lor.lhs.false10.i112
dfs.exit123.thread: ; preds = %if.end
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) @C, i8 -1, i64 48, i1 false)
br label %dfs.exit817
dfs.exit123: ; preds = %if.end.i119, %lor.lhs.false10.i112, %lor.lhs.false.lr.ph.i, %lor.lhs.false4.i106.lr.ph, %dfs.exit
%accumulator.tr35.i.lcssa1152 = phi i32 [ %accumulator.tr35.i.lcssa, %dfs.exit ], [ %accumulator.tr35.i.lcssa1151, %lor.lhs.false4.i106.lr.ph ], [ 0, %lor.lhs.false.lr.ph.i ], [ %accumulator.tr35.i.lcssa1151, %lor.lhs.false10.i112 ], [ %accumulator.tr35.i.lcssa1151, %if.end.i119 ]
%accumulator.tr35.i102.lcssa = phi i32 [ 0, %dfs.exit ], [ 0, %lor.lhs.false4.i106.lr.ph ], [ 0, %lor.lhs.false.lr.ph.i ], [ %10, %if.end.i119 ], [ %accumulator.tr35.i102907919, %lor.lhs.false10.i112 ]
%add = add i32 %accumulator.tr35.i.lcssa1152, -1
%sub = add i32 %add, %accumulator.tr35.i102.lcssa
store i32 %sub, ptr @C, align 16, !tbaa !5
%or.cond.i131923 = or i1 %cmp1.i129.fr, %cmp3.i
br i1 %or.cond.i131923, label %dfs.exit175, label %lor.lhs.false4.i132.lr.ph
lor.lhs.false4.i132.lr.ph: ; preds = %dfs.exit123
%cmp9.i136 = icmp slt i32 %8, %5
%cmp9.i136.fr = freeze i1 %cmp9.i136
br i1 %cmp9.i136.fr, label %lor.lhs.false4.i158.lr.ph, label %lor.lhs.false4.i132.preheader
lor.lhs.false4.i132.preheader: ; preds = %lor.lhs.false4.i132.lr.ph
%cmp5.i133 = icmp sgt i32 %dec4, %8
br label %lor.lhs.false4.i132
lor.lhs.false4.i132: ; preds = %lor.lhs.false4.i132.preheader, %if.end.i145
%accumulator.tr35.i128925 = phi i32 [ %add18.i146, %if.end.i145 ], [ 0, %lor.lhs.false4.i132.preheader ]
%py.tr37.i924 = phi i32 [ %add16.i, %if.end.i145 ], [ %dec4, %lor.lhs.false4.i132.preheader ]
br i1 %cmp5.i133, label %dfs.exit148, label %lor.lhs.false10.i138
lor.lhs.false10.i138: ; preds = %lor.lhs.false4.i132
%idxprom11.i140 = zext i32 %py.tr37.i924 to i64
%arrayidx14.i142 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i, i64 %idxprom11.i140, i64 %indvars.iv
%12 = load i32, ptr %arrayidx14.i142, align 4, !tbaa !5
%cmp15.not.i143 = icmp eq i32 %12, %6
br i1 %cmp15.not.i143, label %if.end.i145, label %dfs.exit148
if.end.i145: ; preds = %lor.lhs.false10.i138
%add16.i = add nsw i32 %py.tr37.i924, -1
%add18.i146 = add nuw nsw i32 %accumulator.tr35.i128925, 1
%exitcond1060 = icmp eq i32 %add18.i146, %.fr
br i1 %exitcond1060, label %dfs.exit148, label %lor.lhs.false4.i132
dfs.exit148: ; preds = %lor.lhs.false4.i132, %if.end.i145, %lor.lhs.false10.i138
%accumulator.tr35.i128.lcssa = phi i32 [ %accumulator.tr35.i128925, %lor.lhs.false10.i138 ], [ %accumulator.tr35.i128925, %lor.lhs.false4.i132 ], [ %.fr, %if.end.i145 ]
br i1 %or.cond.i131923, label %dfs.exit175, label %lor.lhs.false4.i158.lr.ph
lor.lhs.false4.i158.lr.ph: ; preds = %lor.lhs.false4.i132.lr.ph, %dfs.exit148
%accumulator.tr35.i128.lcssa1159 = phi i32 [ %accumulator.tr35.i128.lcssa, %dfs.exit148 ], [ 0, %lor.lhs.false4.i132.lr.ph ]
%cmp9.i162 = icmp slt i32 %8, %5
%cmp9.i162.fr = freeze i1 %cmp9.i162
br i1 %cmp9.i162.fr, label %dfs.exit175.thread, label %lor.lhs.false4.i158.preheader
lor.lhs.false4.i158.preheader: ; preds = %lor.lhs.false4.i158.lr.ph
%cmp5.i1591255 = icmp slt i32 %8, %dec4
br i1 %cmp5.i1591255, label %dfs.exit175, label %lor.lhs.false10.i164
dfs.exit175.thread: ; preds = %lor.lhs.false4.i158.lr.ph
%add231162 = add i32 %accumulator.tr35.i128.lcssa1159, -1
store i32 %add231162, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 1), align 4, !tbaa !5
br label %lor.lhs.false.lr.ph.i177.split
lor.lhs.false10.i164: ; preds = %lor.lhs.false4.i158.preheader, %if.end.i171
%accumulator.tr35.i1549391257 = phi i32 [ %add18.i173, %if.end.i171 ], [ 0, %lor.lhs.false4.i158.preheader ]
%indvars.iv10611256 = phi i64 [ %indvars.iv.next1062, %if.end.i171 ], [ %idxprom11.i, %lor.lhs.false4.i158.preheader ]
%arrayidx14.i168 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i, i64 %indvars.iv10611256, i64 %indvars.iv
%13 = load i32, ptr %arrayidx14.i168, align 4, !tbaa !5
%cmp15.not.i169 = icmp eq i32 %13, %6
br i1 %cmp15.not.i169, label %if.end.i171, label %dfs.exit175
if.end.i171: ; preds = %lor.lhs.false10.i164
%indvars.iv.next1062 = add nuw i64 %indvars.iv10611256, 1
%add18.i173 = add nuw nsw i32 %accumulator.tr35.i1549391257, 1
%14 = trunc i64 %indvars.iv.next1062 to i32
%cmp5.i159 = icmp slt i32 %8, %14
br i1 %cmp5.i159, label %dfs.exit175, label %lor.lhs.false10.i164
dfs.exit175: ; preds = %lor.lhs.false10.i164, %if.end.i171, %lor.lhs.false4.i158.preheader, %dfs.exit123, %dfs.exit148
%accumulator.tr35.i128.lcssa1156 = phi i32 [ %accumulator.tr35.i128.lcssa, %dfs.exit148 ], [ 0, %dfs.exit123 ], [ %accumulator.tr35.i128.lcssa1159, %lor.lhs.false4.i158.preheader ], [ %accumulator.tr35.i128.lcssa1159, %if.end.i171 ], [ %accumulator.tr35.i128.lcssa1159, %lor.lhs.false10.i164 ]
%accumulator.tr35.i154.lcssa = phi i32 [ 0, %dfs.exit148 ], [ 0, %dfs.exit123 ], [ 0, %lor.lhs.false4.i158.preheader ], [ %accumulator.tr35.i1549391257, %lor.lhs.false10.i164 ], [ %add18.i173, %if.end.i171 ]
%add23 = add i32 %accumulator.tr35.i128.lcssa1156, -1
%sub24 = add i32 %add23, %accumulator.tr35.i154.lcssa
store i32 %sub24, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 1), align 4, !tbaa !5
br i1 %cmp3.i, label %dfs.exit229.thread, label %lor.lhs.false.lr.ph.i177.split
lor.lhs.false.lr.ph.i177.split: ; preds = %dfs.exit175.thread, %dfs.exit175
%sub241164 = phi i32 [ %add231162, %dfs.exit175.thread ], [ %sub24, %dfs.exit175 ]
%cmp9.i189 = icmp slt i32 %8, %5
%cmp5.i186 = icmp slt i32 %8, %dec4
%or.cond33.i190 = or i1 %cmp9.i189, %cmp5.i186
%or.cond33.i190.fr = freeze i1 %or.cond33.i190
br i1 %or.cond33.i190.fr, label %lor.lhs.false.lr.ph.i203.split, label %lor.lhs.false.i178.preheader
lor.lhs.false.i178.preheader: ; preds = %lor.lhs.false.lr.ph.i177.split
%smin = tail call i32 @llvm.smin.i32(i32 %dec, i32 0)
%15 = sub i32 %2, %smin
br label %lor.lhs.false.i178
lor.lhs.false.i178: ; preds = %lor.lhs.false.i178.preheader, %if.end.i198
%px.tr36.i = phi i32 [ %add.i, %if.end.i198 ], [ %dec, %lor.lhs.false.i178.preheader ]
%accumulator.tr35.i181 = phi i32 [ %add18.i199, %if.end.i198 ], [ 0, %lor.lhs.false.i178.preheader ]
br i1 %cmp1.i129.fr, label %dfs.exit201, label %lor.lhs.false4.i185
lor.lhs.false4.i185: ; preds = %lor.lhs.false.i178
%idxprom.i192 = zext i32 %px.tr36.i to i64
%arrayidx14.i195 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i192, i64 %idxprom11.i, i64 %indvars.iv
%16 = load i32, ptr %arrayidx14.i195, align 4, !tbaa !5
%cmp15.not.i196 = icmp eq i32 %16, %6
br i1 %cmp15.not.i196, label %if.end.i198, label %dfs.exit201
if.end.i198: ; preds = %lor.lhs.false4.i185
%add.i = add nsw i32 %px.tr36.i, -1
%add18.i199 = add nuw nsw i32 %accumulator.tr35.i181, 1
%cmp.i200 = icmp slt i32 %px.tr36.i, 1
br i1 %cmp.i200, label %dfs.exit201, label %lor.lhs.false.i178
dfs.exit201: ; preds = %lor.lhs.false.i178, %lor.lhs.false4.i185, %if.end.i198
%.us-phi950 = phi i32 [ %accumulator.tr35.i181, %lor.lhs.false4.i185 ], [ %accumulator.tr35.i181, %lor.lhs.false.i178 ], [ %15, %if.end.i198 ]
br i1 %cmp3.i, label %dfs.exit229.thread, label %lor.lhs.false.lr.ph.i203.split
lor.lhs.false.lr.ph.i203.split: ; preds = %lor.lhs.false.lr.ph.i177.split, %dfs.exit201
%.us-phi9501174 = phi i32 [ %.us-phi950, %dfs.exit201 ], [ 0, %lor.lhs.false.lr.ph.i177.split ]
%cmp9.i216 = icmp slt i32 %8, %5
%cmp5.i213 = icmp slt i32 %8, %dec4
%or.cond33.i217 = or i1 %cmp9.i216, %cmp5.i213
%or.cond33.i217.fr = freeze i1 %or.cond33.i217
br i1 %or.cond33.i217.fr, label %dfs.exit229, label %lor.lhs.false.i204.preheader
lor.lhs.false.i204.preheader: ; preds = %lor.lhs.false.lr.ph.i203.split
%cmp.i228 = icmp slt i32 %2, 0
br label %lor.lhs.false.i204
lor.lhs.false.i204: ; preds = %lor.lhs.false.i204.preheader, %if.end.i225
%px.tr36.i207 = phi i32 [ %add.i226, %if.end.i225 ], [ %dec, %lor.lhs.false.i204.preheader ]
%accumulator.tr35.i208 = phi i32 [ %add18.i227, %if.end.i225 ], [ 0, %lor.lhs.false.i204.preheader ]
%cmp1.i209 = icmp slt i32 %8, %px.tr36.i207
br i1 %cmp1.i209, label %dfs.exit229, label %lor.lhs.false4.i212
lor.lhs.false4.i212: ; preds = %lor.lhs.false.i204
%idxprom.i219 = zext i32 %px.tr36.i207 to i64
%arrayidx14.i222 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i219, i64 %idxprom11.i, i64 %indvars.iv
%17 = load i32, ptr %arrayidx14.i222, align 4, !tbaa !5
%cmp15.not.i223 = icmp eq i32 %17, %6
br i1 %cmp15.not.i223, label %if.end.i225, label %dfs.exit229
if.end.i225: ; preds = %lor.lhs.false4.i212
%add.i226 = add nsw i32 %px.tr36.i207, 1
%add18.i227 = add nuw nsw i32 %accumulator.tr35.i208, 1
br i1 %cmp.i228, label %dfs.exit229, label %lor.lhs.false.i204
dfs.exit229.thread: ; preds = %dfs.exit201, %dfs.exit175
%.us-phi9501169.ph = phi i32 [ %.us-phi950, %dfs.exit201 ], [ 0, %dfs.exit175 ]
%sub2411651168.ph = phi i32 [ %sub241164, %dfs.exit201 ], [ %sub24, %dfs.exit175 ]
%add271178 = add i32 %.us-phi9501169.ph, -1
store i32 %add271178, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 2), align 8, !tbaa !5
br label %dfs.exit287.thread
dfs.exit229: ; preds = %lor.lhs.false.i204, %lor.lhs.false4.i212, %if.end.i225, %lor.lhs.false.lr.ph.i203.split
%.us-phi955 = phi i32 [ 0, %lor.lhs.false.lr.ph.i203.split ], [ %add18.i227, %if.end.i225 ], [ %accumulator.tr35.i208, %lor.lhs.false.i204 ], [ %accumulator.tr35.i208, %lor.lhs.false4.i212 ]
%add27 = add i32 %.us-phi9501174, -1
%sub28 = add i32 %add27, %.us-phi955
store i32 %sub28, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 2), align 8, !tbaa !5
br i1 %or.cond.i131923, label %dfs.exit287.thread, label %lor.lhs.false4.i240.preheader
lor.lhs.false4.i240.preheader: ; preds = %dfs.exit229
%cmp5.i241 = icmp sgt i32 %dec4, %8
%cmp9.i244 = icmp sgt i32 %indvars.iv1064, %8
br label %lor.lhs.false4.i240
lor.lhs.false4.i240: ; preds = %lor.lhs.false4.i240.preheader, %if.end.i253
%accumulator.tr35.i236964 = phi i32 [ %add18.i256, %if.end.i253 ], [ 0, %lor.lhs.false4.i240.preheader ]
%py.tr37.i234963 = phi i32 [ %add16.i254, %if.end.i253 ], [ %dec4, %lor.lhs.false4.i240.preheader ]
%ph.tr38.i233962 = phi i32 [ %add17.i255, %if.end.i253 ], [ %5, %lor.lhs.false4.i240.preheader ]
%cmp7.i242 = icmp slt i32 %ph.tr38.i233962, 0
%or.cond19.i243 = or i1 %cmp7.i242, %cmp5.i241
%or.cond33.i245 = or i1 %cmp9.i244, %or.cond19.i243
br i1 %or.cond33.i245, label %dfs.exit258, label %lor.lhs.false10.i246
lor.lhs.false10.i246: ; preds = %lor.lhs.false4.i240
%idxprom11.i248 = zext i32 %py.tr37.i234963 to i64
%idxprom13.i249 = zext i32 %ph.tr38.i233962 to i64
%arrayidx14.i250 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i, i64 %idxprom11.i248, i64 %idxprom13.i249
%18 = load i32, ptr %arrayidx14.i250, align 4, !tbaa !5
%cmp15.not.i251 = icmp eq i32 %18, %6
br i1 %cmp15.not.i251, label %if.end.i253, label %dfs.exit258
if.end.i253: ; preds = %lor.lhs.false10.i246
%add16.i254 = add nsw i32 %py.tr37.i234963, -1
%add17.i255 = add nsw i32 %ph.tr38.i233962, -1
%add18.i256 = add nuw nsw i32 %accumulator.tr35.i236964, 1
%exitcond1066 = icmp eq i32 %add18.i256, %.fr
br i1 %exitcond1066, label %dfs.exit258, label %lor.lhs.false4.i240
dfs.exit258: ; preds = %lor.lhs.false4.i240, %if.end.i253, %lor.lhs.false10.i246
%accumulator.tr35.i236.lcssa = phi i32 [ %accumulator.tr35.i236964, %lor.lhs.false10.i246 ], [ %accumulator.tr35.i236964, %lor.lhs.false4.i240 ], [ %.fr, %if.end.i253 ]
br i1 %or.cond.i131923, label %dfs.exit287.thread, label %lor.lhs.false4.i269.preheader
lor.lhs.false4.i269.preheader: ; preds = %dfs.exit258
%19 = sext i32 %8 to i64
%cmp5.i2701259 = icmp slt i32 %8, %dec4
%cmp9.i2731260 = icmp sgt i64 %indvars.iv, %19
%or.cond33.i2741261 = or i1 %cmp9.i2731260, %cmp5.i2701259
br i1 %or.cond33.i2741261, label %dfs.exit287, label %lor.lhs.false10.i275
lor.lhs.false10.i275: ; preds = %lor.lhs.false4.i269.preheader, %if.end.i282
%accumulator.tr35.i2659751264 = phi i32 [ %add18.i285, %if.end.i282 ], [ 0, %lor.lhs.false4.i269.preheader ]
%indvars.iv10671263 = phi i64 [ %indvars.iv.next1068, %if.end.i282 ], [ %idxprom11.i, %lor.lhs.false4.i269.preheader ]
%indvars.iv10701262 = phi i64 [ %indvars.iv.next1071, %if.end.i282 ], [ %indvars.iv, %lor.lhs.false4.i269.preheader ]
%arrayidx14.i279 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i, i64 %indvars.iv10671263, i64 %indvars.iv10701262
%20 = load i32, ptr %arrayidx14.i279, align 4, !tbaa !5
%cmp15.not.i280 = icmp eq i32 %20, %6
br i1 %cmp15.not.i280, label %if.end.i282, label %dfs.exit287
if.end.i282: ; preds = %lor.lhs.false10.i275
%indvars.iv.next1068 = add nuw nsw i64 %indvars.iv10671263, 1
%indvars.iv.next1071 = add nuw nsw i64 %indvars.iv10701262, 1
%add18.i285 = add nuw nsw i32 %accumulator.tr35.i2659751264, 1
%21 = trunc i64 %indvars.iv.next1068 to i32
%cmp5.i270 = icmp slt i32 %8, %21
%cmp9.i273 = icmp sge i64 %indvars.iv10701262, %19
%or.cond33.i274 = or i1 %cmp9.i273, %cmp5.i270
br i1 %or.cond33.i274, label %dfs.exit287, label %lor.lhs.false10.i275
dfs.exit287.thread: ; preds = %dfs.exit258, %dfs.exit229.thread, %dfs.exit229
%accumulator.tr35.i236.lcssa1187.ph = phi i32 [ %accumulator.tr35.i236.lcssa, %dfs.exit258 ], [ 0, %dfs.exit229.thread ], [ 0, %dfs.exit229 ]
%sub241165116811801186.ph = phi i32 [ %sub241164, %dfs.exit258 ], [ %sub2411651168.ph, %dfs.exit229.thread ], [ %sub241164, %dfs.exit229 ]
%sub2811811185.ph = phi i32 [ %sub28, %dfs.exit258 ], [ %add271178, %dfs.exit229.thread ], [ %sub28, %dfs.exit229 ]
%add311192 = add i32 %accumulator.tr35.i236.lcssa1187.ph, -1
store i32 %add311192, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 3), align 4, !tbaa !5
br label %dfs.exit345
dfs.exit287: ; preds = %lor.lhs.false10.i275, %if.end.i282, %lor.lhs.false4.i269.preheader
%accumulator.tr35.i265975.lcssa = phi i32 [ 0, %lor.lhs.false4.i269.preheader ], [ %accumulator.tr35.i2659751264, %lor.lhs.false10.i275 ], [ %add18.i285, %if.end.i282 ]
%add31 = add i32 %accumulator.tr35.i236.lcssa, -1
%sub32 = add i32 %add31, %accumulator.tr35.i265975.lcssa
store i32 %sub32, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 3), align 4, !tbaa !5
br i1 %or.cond.i131923, label %dfs.exit345, label %lor.lhs.false4.i298.preheader
lor.lhs.false4.i298.preheader: ; preds = %dfs.exit287
%cmp9.i302 = icmp sgt i32 %indvars.iv1064, %8
%cmp5.i2991267 = icmp slt i32 %8, %dec4
%cmp7.i3001268 = icmp slt i32 %5, 0
%or.cond19.i3011269 = or i1 %cmp7.i3001268, %cmp5.i2991267
%or.cond33.i3031270 = or i1 %cmp9.i302, %or.cond19.i3011269
br i1 %or.cond33.i3031270, label %dfs.exit316, label %lor.lhs.false10.i304
lor.lhs.false10.i304: ; preds = %lor.lhs.false4.i298.preheader, %if.end.i311
%ph.tr38.i2919841273 = phi i32 [ %add17.i313, %if.end.i311 ], [ %5, %lor.lhs.false4.i298.preheader ]
%accumulator.tr35.i2949861272 = phi i32 [ %add18.i314, %if.end.i311 ], [ 0, %lor.lhs.false4.i298.preheader ]
%indvars.iv10761271 = phi i64 [ %indvars.iv.next1077, %if.end.i311 ], [ %idxprom11.i, %lor.lhs.false4.i298.preheader ]
%idxprom13.i307 = zext i32 %ph.tr38.i2919841273 to i64
%arrayidx14.i308 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i, i64 %indvars.iv10761271, i64 %idxprom13.i307
%22 = load i32, ptr %arrayidx14.i308, align 4, !tbaa !5
%cmp15.not.i309 = icmp eq i32 %22, %6
br i1 %cmp15.not.i309, label %if.end.i311, label %dfs.exit316
if.end.i311: ; preds = %lor.lhs.false10.i304
%indvars.iv.next1077 = add nuw nsw i64 %indvars.iv10761271, 1
%add17.i313 = add nsw i32 %ph.tr38.i2919841273, -1
%add18.i314 = add nuw nsw i32 %accumulator.tr35.i2949861272, 1
%23 = trunc i64 %indvars.iv.next1077 to i32
%cmp5.i299 = icmp slt i32 %8, %23
%cmp7.i300 = icmp slt i32 %ph.tr38.i2919841273, 1
%or.cond19.i301 = or i1 %cmp7.i300, %cmp5.i299
%or.cond33.i303 = or i1 %cmp9.i302, %or.cond19.i301
br i1 %or.cond33.i303, label %dfs.exit316, label %lor.lhs.false10.i304
dfs.exit316: ; preds = %lor.lhs.false10.i304, %if.end.i311, %lor.lhs.false4.i298.preheader
%accumulator.tr35.i294986.lcssa = phi i32 [ 0, %lor.lhs.false4.i298.preheader ], [ %accumulator.tr35.i2949861272, %lor.lhs.false10.i304 ], [ %add18.i314, %if.end.i311 ]
br i1 %or.cond.i131923, label %dfs.exit345, label %lor.lhs.false4.i327.preheader
lor.lhs.false4.i327.preheader: ; preds = %dfs.exit316
%24 = sext i32 %8 to i64
%cmp5.i328 = icmp sgt i32 %dec4, %8
br label %lor.lhs.false4.i327
lor.lhs.false4.i327: ; preds = %lor.lhs.false4.i327.preheader, %if.end.i340
%indvars.iv1080 = phi i64 [ %indvars.iv, %lor.lhs.false4.i327.preheader ], [ %indvars.iv.next1081, %if.end.i340 ]
%accumulator.tr35.i323997 = phi i32 [ 0, %lor.lhs.false4.i327.preheader ], [ %add18.i343, %if.end.i340 ]
%py.tr37.i321996 = phi i32 [ %dec4, %lor.lhs.false4.i327.preheader ], [ %add16.i341, %if.end.i340 ]
%cmp9.i331 = icmp sgt i64 %indvars.iv1080, %24
%or.cond33.i332 = or i1 %cmp9.i331, %cmp5.i328
br i1 %or.cond33.i332, label %dfs.exit345, label %lor.lhs.false10.i333
lor.lhs.false10.i333: ; preds = %lor.lhs.false4.i327
%idxprom11.i335 = zext i32 %py.tr37.i321996 to i64
%arrayidx14.i337 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i, i64 %idxprom11.i335, i64 %indvars.iv1080
%25 = load i32, ptr %arrayidx14.i337, align 4, !tbaa !5
%cmp15.not.i338 = icmp eq i32 %25, %6
br i1 %cmp15.not.i338, label %if.end.i340, label %dfs.exit345
if.end.i340: ; preds = %lor.lhs.false10.i333
%add16.i341 = add nsw i32 %py.tr37.i321996, -1
%indvars.iv.next1081 = add nuw nsw i64 %indvars.iv1080, 1
%add18.i343 = add nuw nsw i32 %accumulator.tr35.i323997, 1
%exitcond1083 = icmp eq i32 %add18.i343, %.fr
br i1 %exitcond1083, label %dfs.exit345, label %lor.lhs.false4.i327
dfs.exit345: ; preds = %lor.lhs.false4.i327, %if.end.i340, %lor.lhs.false10.i333, %dfs.exit287, %dfs.exit287.thread, %dfs.exit316
%accumulator.tr35.i294.lcssa1204 = phi i32 [ %accumulator.tr35.i294986.lcssa, %dfs.exit316 ], [ 0, %dfs.exit287.thread ], [ 0, %dfs.exit287 ], [ %accumulator.tr35.i294986.lcssa, %lor.lhs.false10.i333 ], [ %accumulator.tr35.i294986.lcssa, %if.end.i340 ], [ %accumulator.tr35.i294986.lcssa, %lor.lhs.false4.i327 ]
%sub24116511681180118611941203 = phi i32 [ %sub241164, %dfs.exit316 ], [ %sub241165116811801186.ph, %dfs.exit287.thread ], [ %sub241164, %dfs.exit287 ], [ %sub241164, %lor.lhs.false10.i333 ], [ %sub241164, %if.end.i340 ], [ %sub241164, %lor.lhs.false4.i327 ]
%sub281181118511951202 = phi i32 [ %sub28, %dfs.exit316 ], [ %sub2811811185.ph, %dfs.exit287.thread ], [ %sub28, %dfs.exit287 ], [ %sub28, %lor.lhs.false10.i333 ], [ %sub28, %if.end.i340 ], [ %sub28, %lor.lhs.false4.i327 ]
%sub3211961201 = phi i32 [ %sub32, %dfs.exit316 ], [ %add311192, %dfs.exit287.thread ], [ %sub32, %dfs.exit287 ], [ %sub32, %lor.lhs.false10.i333 ], [ %sub32, %if.end.i340 ], [ %sub32, %lor.lhs.false4.i327 ]
%accumulator.tr35.i323.lcssa = phi i32 [ 0, %dfs.exit316 ], [ 0, %dfs.exit287.thread ], [ 0, %dfs.exit287 ], [ %accumulator.tr35.i323997, %lor.lhs.false4.i327 ], [ %.fr, %if.end.i340 ], [ %accumulator.tr35.i323997, %lor.lhs.false10.i333 ]
%add35 = add nsw i32 %accumulator.tr35.i294.lcssa1204, -1
%sub36 = add i32 %add35, %accumulator.tr35.i323.lcssa
store i32 %sub36, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 4), align 16, !tbaa !5
br i1 %cmp3.i, label %dfs.exit403.thread, label %lor.lhs.false.lr.ph.i347.split
lor.lhs.false.lr.ph.i347.split: ; preds = %dfs.exit345
%cmp5.i357 = icmp slt i32 %8, %dec4
%cmp5.i357.fr = freeze i1 %cmp5.i357
br i1 %cmp5.i357.fr, label %lor.lhs.false.lr.ph.i376.split, label %lor.lhs.false.i348.preheader
lor.lhs.false.i348.preheader: ; preds = %lor.lhs.false.lr.ph.i347.split
%smin1085 = tail call i32 @llvm.smin.i32(i32 %dec, i32 0)
%26 = sub i32 %2, %smin1085
%cmp9.i360 = icmp sgt i32 %indvars.iv1064, %8
br label %lor.lhs.false.i348
lor.lhs.false.i348: ; preds = %lor.lhs.false.i348.preheader, %if.end.i369
%ph.tr38.i349 = phi i32 [ %add17.i371, %if.end.i369 ], [ %5, %lor.lhs.false.i348.preheader ]
%px.tr36.i351 = phi i32 [ %add.i370, %if.end.i369 ], [ %dec, %lor.lhs.false.i348.preheader ]
%accumulator.tr35.i352 = phi i32 [ %add18.i372, %if.end.i369 ], [ 0, %lor.lhs.false.i348.preheader ]
%cmp7.i358 = icmp slt i32 %ph.tr38.i349, 0
%or.cond33.i361 = or i1 %cmp9.i360, %cmp7.i358
%or.cond1251 = select i1 %cmp1.i129.fr, i1 true, i1 %or.cond33.i361
br i1 %or.cond1251, label %dfs.exit374, label %lor.lhs.false10.i362
lor.lhs.false10.i362: ; preds = %lor.lhs.false.i348
%idxprom.i363 = zext i32 %px.tr36.i351 to i64
%idxprom13.i365 = zext i32 %ph.tr38.i349 to i64
%arrayidx14.i366 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i363, i64 %idxprom11.i, i64 %idxprom13.i365
%27 = load i32, ptr %arrayidx14.i366, align 4, !tbaa !5
%cmp15.not.i367 = icmp eq i32 %27, %6
br i1 %cmp15.not.i367, label %if.end.i369, label %dfs.exit374
if.end.i369: ; preds = %lor.lhs.false10.i362
%add.i370 = add nsw i32 %px.tr36.i351, -1
%add17.i371 = add nsw i32 %ph.tr38.i349, -1
%add18.i372 = add nuw nsw i32 %accumulator.tr35.i352, 1
%cmp.i373 = icmp slt i32 %px.tr36.i351, 1
br i1 %cmp.i373, label %dfs.exit374, label %lor.lhs.false.i348
dfs.exit374: ; preds = %lor.lhs.false.i348, %lor.lhs.false10.i362, %if.end.i369
%.us-phi1004 = phi i32 [ %accumulator.tr35.i352, %lor.lhs.false10.i362 ], [ %accumulator.tr35.i352, %lor.lhs.false.i348 ], [ %26, %if.end.i369 ]
br i1 %cmp3.i, label %dfs.exit403.thread, label %lor.lhs.false.lr.ph.i376.split
lor.lhs.false.lr.ph.i376.split: ; preds = %lor.lhs.false.lr.ph.i347.split, %dfs.exit374
%.us-phi10041209 = phi i32 [ %.us-phi1004, %dfs.exit374 ], [ 0, %lor.lhs.false.lr.ph.i347.split ]
%cmp5.i386 = icmp slt i32 %8, %dec4
%cmp5.i386.fr = freeze i1 %cmp5.i386
br i1 %cmp5.i386.fr, label %dfs.exit403.thread1215, label %lor.lhs.false.i377.preheader
dfs.exit403.thread1215: ; preds = %lor.lhs.false.lr.ph.i376.split
%add391218 = add i32 %.us-phi10041209, -1
store i32 %add391218, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 5), align 4, !tbaa !5
br label %lor.lhs.false.lr.ph.i405.split
lor.lhs.false.i377.preheader: ; preds = %lor.lhs.false.lr.ph.i376.split
%28 = sext i32 %8 to i64
%cmp.i402 = icmp slt i32 %2, 0
br label %lor.lhs.false.i377
lor.lhs.false.i377: ; preds = %lor.lhs.false.i377.preheader, %if.end.i398
%indvars.iv1087 = phi i64 [ %indvars.iv, %lor.lhs.false.i377.preheader ], [ %indvars.iv.next1088, %if.end.i398 ]
%px.tr36.i380 = phi i32 [ %dec, %lor.lhs.false.i377.preheader ], [ %add.i399, %if.end.i398 ]
%accumulator.tr35.i381 = phi i32 [ 0, %lor.lhs.false.i377.preheader ], [ %add18.i401, %if.end.i398 ]
%cmp1.i382 = icmp slt i32 %8, %px.tr36.i380
%cmp9.i389 = icmp sgt i64 %indvars.iv1087, %28
%or.cond = select i1 %cmp1.i382, i1 true, i1 %cmp9.i389
br i1 %or.cond, label %dfs.exit403, label %lor.lhs.false10.i391
lor.lhs.false10.i391: ; preds = %lor.lhs.false.i377
%idxprom.i392 = zext i32 %px.tr36.i380 to i64
%arrayidx14.i395 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i392, i64 %idxprom11.i, i64 %indvars.iv1087
%29 = load i32, ptr %arrayidx14.i395, align 4, !tbaa !5
%cmp15.not.i396 = icmp eq i32 %29, %6
br i1 %cmp15.not.i396, label %if.end.i398, label %dfs.exit403
if.end.i398: ; preds = %lor.lhs.false10.i391
%add.i399 = add nsw i32 %px.tr36.i380, 1
%indvars.iv.next1088 = add nuw nsw i64 %indvars.iv1087, 1
%add18.i401 = add nuw nsw i32 %accumulator.tr35.i381, 1
br i1 %cmp.i402, label %dfs.exit403, label %lor.lhs.false.i377
dfs.exit403.thread: ; preds = %dfs.exit374, %dfs.exit345
%.us-phi10041206.ph = phi i32 [ %.us-phi1004, %dfs.exit374 ], [ 0, %dfs.exit345 ]
%add391212 = add i32 %.us-phi10041206.ph, -1
store i32 %add391212, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 5), align 4, !tbaa !5
br label %dfs.exit461
dfs.exit403: ; preds = %lor.lhs.false.i377, %lor.lhs.false10.i391, %if.end.i398
%.us-phi1010 = phi i32 [ %accumulator.tr35.i381, %lor.lhs.false10.i391 ], [ %accumulator.tr35.i381, %lor.lhs.false.i377 ], [ %add18.i401, %if.end.i398 ]
%add39 = add i32 %.us-phi10041209, -1
%sub40 = add i32 %add39, %.us-phi1010
store i32 %sub40, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 5), align 4, !tbaa !5
br i1 %cmp3.i, label %dfs.exit461, label %lor.lhs.false.lr.ph.i405.split
lor.lhs.false.lr.ph.i405.split: ; preds = %dfs.exit403.thread1215, %dfs.exit403
%sub401220 = phi i32 [ %add391218, %dfs.exit403.thread1215 ], [ %sub40, %dfs.exit403 ]
%cmp5.i415 = icmp slt i32 %8, %dec4
%cmp5.i415.fr = freeze i1 %cmp5.i415
br i1 %cmp5.i415.fr, label %lor.lhs.false.lr.ph.i434.split, label %lor.lhs.false.i406.preheader
lor.lhs.false.i406.preheader: ; preds = %lor.lhs.false.lr.ph.i405.split
%cmp9.i418 = icmp sgt i32 %indvars.iv1064, %8
%cmp.i431 = icmp slt i32 %2, 0
br label %lor.lhs.false.i406
lor.lhs.false.i406: ; preds = %lor.lhs.false.i406.preheader, %if.end.i427
%ph.tr38.i407 = phi i32 [ %add17.i429, %if.end.i427 ], [ %5, %lor.lhs.false.i406.preheader ]
%px.tr36.i409 = phi i32 [ %add.i428, %if.end.i427 ], [ %dec, %lor.lhs.false.i406.preheader ]
%accumulator.tr35.i410 = phi i32 [ %add18.i430, %if.end.i427 ], [ 0, %lor.lhs.false.i406.preheader ]
%cmp1.i411 = icmp slt i32 %8, %px.tr36.i409
%cmp7.i416 = icmp slt i32 %ph.tr38.i407, 0
%or.cond33.i419 = or i1 %cmp9.i418, %cmp7.i416
%or.cond1252 = select i1 %cmp1.i411, i1 true, i1 %or.cond33.i419
br i1 %or.cond1252, label %dfs.exit432, label %lor.lhs.false10.i420
lor.lhs.false10.i420: ; preds = %lor.lhs.false.i406
%idxprom.i421 = zext i32 %px.tr36.i409 to i64
%idxprom13.i423 = zext i32 %ph.tr38.i407 to i64
%arrayidx14.i424 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i421, i64 %idxprom11.i, i64 %idxprom13.i423
%30 = load i32, ptr %arrayidx14.i424, align 4, !tbaa !5
%cmp15.not.i425 = icmp eq i32 %30, %6
br i1 %cmp15.not.i425, label %if.end.i427, label %dfs.exit432
if.end.i427: ; preds = %lor.lhs.false10.i420
%add.i428 = add nsw i32 %px.tr36.i409, 1
%add17.i429 = add nsw i32 %ph.tr38.i407, -1
%add18.i430 = add nuw nsw i32 %accumulator.tr35.i410, 1
br i1 %cmp.i431, label %dfs.exit432, label %lor.lhs.false.i406
dfs.exit432: ; preds = %lor.lhs.false.i406, %lor.lhs.false10.i420, %if.end.i427
%.us-phi1016 = phi i32 [ %accumulator.tr35.i410, %lor.lhs.false10.i420 ], [ %accumulator.tr35.i410, %lor.lhs.false.i406 ], [ %add18.i430, %if.end.i427 ]
br i1 %cmp3.i, label %dfs.exit461, label %lor.lhs.false.lr.ph.i434.split
lor.lhs.false.lr.ph.i434.split: ; preds = %lor.lhs.false.lr.ph.i405.split, %dfs.exit432
%.us-phi10161229 = phi i32 [ %.us-phi1016, %dfs.exit432 ], [ 0, %lor.lhs.false.lr.ph.i405.split ]
%cmp5.i444 = icmp slt i32 %8, %dec4
%cmp5.i444.fr = freeze i1 %cmp5.i444
br i1 %cmp5.i444.fr, label %dfs.exit461, label %lor.lhs.false.i435.preheader
lor.lhs.false.i435.preheader: ; preds = %lor.lhs.false.lr.ph.i434.split
%31 = sext i32 %8 to i64
%smin1094 = tail call i32 @llvm.smin.i32(i32 %dec, i32 0)
%32 = sub i32 %2, %smin1094
br label %lor.lhs.false.i435
lor.lhs.false.i435: ; preds = %lor.lhs.false.i435.preheader, %if.end.i456
%indvars.iv1092 = phi i64 [ %indvars.iv, %lor.lhs.false.i435.preheader ], [ %indvars.iv.next1093, %if.end.i456 ]
%px.tr36.i438 = phi i32 [ %dec, %lor.lhs.false.i435.preheader ], [ %add.i457, %if.end.i456 ]
%accumulator.tr35.i439 = phi i32 [ 0, %lor.lhs.false.i435.preheader ], [ %add18.i459, %if.end.i456 ]
%cmp9.i447 = icmp sgt i64 %indvars.iv1092, %31
%or.cond1036 = select i1 %cmp1.i129.fr, i1 true, i1 %cmp9.i447
br i1 %or.cond1036, label %dfs.exit461, label %lor.lhs.false10.i449
lor.lhs.false10.i449: ; preds = %lor.lhs.false.i435
%idxprom.i450 = zext i32 %px.tr36.i438 to i64
%arrayidx14.i453 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i450, i64 %idxprom11.i, i64 %indvars.iv1092
%33 = load i32, ptr %arrayidx14.i453, align 4, !tbaa !5
%cmp15.not.i454 = icmp eq i32 %33, %6
br i1 %cmp15.not.i454, label %if.end.i456, label %dfs.exit461
if.end.i456: ; preds = %lor.lhs.false10.i449
%add.i457 = add nsw i32 %px.tr36.i438, -1
%indvars.iv.next1093 = add nuw nsw i64 %indvars.iv1092, 1
%add18.i459 = add nuw nsw i32 %accumulator.tr35.i439, 1
%cmp.i460 = icmp slt i32 %px.tr36.i438, 1
br i1 %cmp.i460, label %dfs.exit461, label %lor.lhs.false.i435
dfs.exit461: ; preds = %lor.lhs.false.i435, %lor.lhs.false10.i449, %if.end.i456, %dfs.exit403, %dfs.exit403.thread, %lor.lhs.false.lr.ph.i434.split, %dfs.exit432
%.us-phi10161224 = phi i32 [ %.us-phi1016, %dfs.exit432 ], [ %.us-phi10161229, %lor.lhs.false.lr.ph.i434.split ], [ 0, %dfs.exit403.thread ], [ 0, %dfs.exit403 ], [ %.us-phi10161229, %if.end.i456 ], [ %.us-phi10161229, %lor.lhs.false10.i449 ], [ %.us-phi10161229, %lor.lhs.false.i435 ]
%sub4012141223 = phi i32 [ %sub401220, %dfs.exit432 ], [ %sub401220, %lor.lhs.false.lr.ph.i434.split ], [ %add391212, %dfs.exit403.thread ], [ %sub40, %dfs.exit403 ], [ %sub401220, %if.end.i456 ], [ %sub401220, %lor.lhs.false10.i449 ], [ %sub401220, %lor.lhs.false.i435 ]
%.us-phi1022 = phi i32 [ 0, %dfs.exit432 ], [ 0, %lor.lhs.false.lr.ph.i434.split ], [ 0, %dfs.exit403.thread ], [ 0, %dfs.exit403 ], [ %accumulator.tr35.i439, %lor.lhs.false.i435 ], [ %accumulator.tr35.i439, %lor.lhs.false10.i449 ], [ %32, %if.end.i456 ]
%add43 = add i32 %.us-phi10161224, -1
%sub44 = add i32 %add43, %.us-phi1022
store i32 %sub44, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 6), align 8, !tbaa !5
%cmp9.i476 = icmp slt i32 %8, %5
%cmp9.i476.fr = freeze i1 %cmp9.i476
br i1 %cmp9.i476.fr, label %dfs.exit519.thread, label %lor.lhs.false.i464.preheader
lor.lhs.false.i464.preheader: ; preds = %dfs.exit461
%smin1096 = tail call i32 @llvm.smin.i32(i32 %dec, i32 0)
%34 = sub i32 %2, %smin1096
%cmp5.i473 = icmp sgt i32 %dec4, %8
br label %lor.lhs.false.i464
lor.lhs.false.i464: ; preds = %lor.lhs.false.i464.preheader, %if.end.i485
%py.tr37.i466 = phi i32 [ %add16.i487, %if.end.i485 ], [ %dec4, %lor.lhs.false.i464.preheader ]
%px.tr36.i467 = phi i32 [ %add.i486, %if.end.i485 ], [ %dec, %lor.lhs.false.i464.preheader ]
%accumulator.tr35.i468 = phi i32 [ %add18.i488, %if.end.i485 ], [ 0, %lor.lhs.false.i464.preheader ]
%cmp3.i470 = icmp slt i32 %py.tr37.i466, 0
%35 = or i1 %cmp3.i470, %cmp5.i473
%or.cond1037 = or i1 %35, %cmp1.i129.fr
br i1 %or.cond1037, label %dfs.exit490, label %lor.lhs.false10.i478
lor.lhs.false10.i478: ; preds = %lor.lhs.false.i464
%idxprom.i479 = zext i32 %px.tr36.i467 to i64
%idxprom11.i480 = zext i32 %py.tr37.i466 to i64
%arrayidx14.i482 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i479, i64 %idxprom11.i480, i64 %indvars.iv
%36 = load i32, ptr %arrayidx14.i482, align 4, !tbaa !5
%cmp15.not.i483 = icmp eq i32 %36, %6
br i1 %cmp15.not.i483, label %if.end.i485, label %dfs.exit490
if.end.i485: ; preds = %lor.lhs.false10.i478
%add.i486 = add nsw i32 %px.tr36.i467, -1
%add16.i487 = add nsw i32 %py.tr37.i466, -1
%add18.i488 = add nuw nsw i32 %accumulator.tr35.i468, 1
%cmp.i489 = icmp slt i32 %px.tr36.i467, 1
br i1 %cmp.i489, label %dfs.exit490, label %lor.lhs.false.i464
dfs.exit490: ; preds = %if.end.i485, %lor.lhs.false10.i478, %lor.lhs.false.i464
%.us-phi1028 = phi i32 [ %accumulator.tr35.i468, %lor.lhs.false10.i478 ], [ %accumulator.tr35.i468, %lor.lhs.false.i464 ], [ %34, %if.end.i485 ]
br i1 %cmp9.i476.fr, label %dfs.exit519.thread, label %lor.lhs.false.i493.preheader
lor.lhs.false.i493.preheader: ; preds = %dfs.exit490
%cmp3.i499 = icmp slt i32 %.fr, 1
%cmp.i518 = icmp slt i32 %2, 0
br label %lor.lhs.false.i493
lor.lhs.false.i493: ; preds = %lor.lhs.false.i493.preheader, %if.end.i514
%indvars.iv1097 = phi i64 [ %idxprom11.i, %lor.lhs.false.i493.preheader ], [ %indvars.iv.next1098, %if.end.i514 ]
%px.tr36.i496 = phi i32 [ %dec, %lor.lhs.false.i493.preheader ], [ %add.i515, %if.end.i514 ]
%accumulator.tr35.i497 = phi i32 [ 0, %lor.lhs.false.i493.preheader ], [ %add18.i517, %if.end.i514 ]
%cmp1.i498 = icmp slt i32 %8, %px.tr36.i496
%or.cond.i500 = or i1 %cmp3.i499, %cmp1.i498
%37 = trunc i64 %indvars.iv1097 to i32
%cmp5.i502 = icmp slt i32 %8, %37
%or.cond1038 = or i1 %or.cond.i500, %cmp5.i502
br i1 %or.cond1038, label %dfs.exit519, label %lor.lhs.false10.i507
lor.lhs.false10.i507: ; preds = %lor.lhs.false.i493
%idxprom.i508 = zext i32 %px.tr36.i496 to i64
%arrayidx14.i511 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i508, i64 %indvars.iv1097, i64 %indvars.iv
%38 = load i32, ptr %arrayidx14.i511, align 4, !tbaa !5
%cmp15.not.i512 = icmp eq i32 %38, %6
br i1 %cmp15.not.i512, label %if.end.i514, label %dfs.exit519
if.end.i514: ; preds = %lor.lhs.false10.i507
%add.i515 = add nsw i32 %px.tr36.i496, 1
%indvars.iv.next1098 = add nuw i64 %indvars.iv1097, 1
%add18.i517 = add nuw nsw i32 %accumulator.tr35.i497, 1
br i1 %cmp.i518, label %dfs.exit519, label %lor.lhs.false.i493
dfs.exit519.thread: ; preds = %dfs.exit490, %dfs.exit461
%.us-phi10281231.ph = phi i32 [ %.us-phi1028, %dfs.exit490 ], [ 0, %dfs.exit461 ]
%add471235 = add i32 %.us-phi10281231.ph, -1
store i32 %add471235, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 7), align 4, !tbaa !5
br label %lor.lhs.false.lr.ph.i550.split.us
dfs.exit519: ; preds = %if.end.i514, %lor.lhs.false10.i507, %lor.lhs.false.i493
%.us-phi1029 = phi i32 [ %accumulator.tr35.i497, %lor.lhs.false10.i507 ], [ %accumulator.tr35.i497, %lor.lhs.false.i493 ], [ %add18.i517, %if.end.i514 ]
%add47 = add i32 %.us-phi1028, -1
%sub48 = add i32 %add47, %.us-phi1029
store i32 %sub48, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 7), align 4, !tbaa !5
br i1 %cmp9.i476.fr, label %lor.lhs.false.lr.ph.i550.split.us, label %lor.lhs.false.i522.preheader
lor.lhs.false.i522.preheader: ; preds = %dfs.exit519
%cmp5.i531 = icmp sgt i32 %dec4, %8
%cmp.i547 = icmp slt i32 %2, 0
br label %lor.lhs.false.i522
lor.lhs.false.i522: ; preds = %lor.lhs.false.i522.preheader, %if.end.i543
%py.tr37.i524 = phi i32 [ %add16.i545, %if.end.i543 ], [ %dec4, %lor.lhs.false.i522.preheader ]
%px.tr36.i525 = phi i32 [ %add.i544, %if.end.i543 ], [ %dec, %lor.lhs.false.i522.preheader ]
%accumulator.tr35.i526 = phi i32 [ %add18.i546, %if.end.i543 ], [ 0, %lor.lhs.false.i522.preheader ]
%cmp1.i527 = icmp slt i32 %8, %px.tr36.i525
%cmp3.i528 = icmp slt i32 %py.tr37.i524, 0
%or.cond.i529 = or i1 %cmp3.i528, %cmp1.i527
%or.cond1039 = or i1 %or.cond.i529, %cmp5.i531
br i1 %or.cond1039, label %dfs.exit548, label %lor.lhs.false10.i536
lor.lhs.false10.i536: ; preds = %lor.lhs.false.i522
%idxprom.i537 = zext i32 %px.tr36.i525 to i64
%idxprom11.i538 = zext i32 %py.tr37.i524 to i64
%arrayidx14.i540 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i537, i64 %idxprom11.i538, i64 %indvars.iv
%39 = load i32, ptr %arrayidx14.i540, align 4, !tbaa !5
%cmp15.not.i541 = icmp eq i32 %39, %6
br i1 %cmp15.not.i541, label %if.end.i543, label %dfs.exit548
if.end.i543: ; preds = %lor.lhs.false10.i536
%add.i544 = add nsw i32 %px.tr36.i525, 1
%add16.i545 = add nsw i32 %py.tr37.i524, -1
%add18.i546 = add nuw nsw i32 %accumulator.tr35.i526, 1
br i1 %cmp.i547, label %dfs.exit548, label %lor.lhs.false.i522
dfs.exit548: ; preds = %if.end.i543, %lor.lhs.false10.i536, %lor.lhs.false.i522
%.us-phi1030 = phi i32 [ %accumulator.tr35.i526, %lor.lhs.false10.i536 ], [ %accumulator.tr35.i526, %lor.lhs.false.i522 ], [ %add18.i546, %if.end.i543 ]
br i1 %cmp9.i476.fr, label %lor.lhs.false.lr.ph.i550.split.us, label %lor.lhs.false.i551.preheader
lor.lhs.false.i551.preheader: ; preds = %dfs.exit548
%smin1102 = tail call i32 @llvm.smin.i32(i32 %dec, i32 0)
%40 = sub i32 %2, %smin1102
%cmp3.i557 = icmp slt i32 %.fr, 1
br label %lor.lhs.false.i551
lor.lhs.false.lr.ph.i550.split.us: ; preds = %dfs.exit519.thread, %dfs.exit519, %dfs.exit548
%.us-phi10301244 = phi i32 [ %.us-phi1030, %dfs.exit548 ], [ 0, %dfs.exit519 ], [ 0, %dfs.exit519.thread ]
%sub4812371242 = phi i32 [ %sub48, %dfs.exit548 ], [ %sub48, %dfs.exit519 ], [ %add471235, %dfs.exit519.thread ]
%.pre1148 = tail call i32 @llvm.smin.i32(i32 %dec, i32 0)
%.pre1149 = sub i32 %2, %.pre1148
br label %dfs.exit577
lor.lhs.false.i551: ; preds = %lor.lhs.false.i551.preheader, %if.end.i572
%indvars.iv1100 = phi i64 [ %idxprom11.i, %lor.lhs.false.i551.preheader ], [ %indvars.iv.next1101, %if.end.i572 ]
%px.tr36.i554 = phi i32 [ %dec, %lor.lhs.false.i551.preheader ], [ %add.i573, %if.end.i572 ]
%accumulator.tr35.i555 = phi i32 [ 0, %lor.lhs.false.i551.preheader ], [ %add18.i575, %if.end.i572 ]
%41 = trunc i64 %indvars.iv1100 to i32
%cmp5.i560 = icmp slt i32 %8, %41
%42 = or i1 %cmp3.i557, %cmp5.i560
%or.cond1040 = or i1 %42, %cmp1.i129.fr
br i1 %or.cond1040, label %dfs.exit577, label %lor.lhs.false10.i565
lor.lhs.false10.i565: ; preds = %lor.lhs.false.i551
%idxprom.i566 = zext i32 %px.tr36.i554 to i64
%arrayidx14.i569 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i566, i64 %indvars.iv1100, i64 %indvars.iv
%43 = load i32, ptr %arrayidx14.i569, align 4, !tbaa !5
%cmp15.not.i570 = icmp eq i32 %43, %6
br i1 %cmp15.not.i570, label %if.end.i572, label %dfs.exit577
if.end.i572: ; preds = %lor.lhs.false10.i565
%add.i573 = add nsw i32 %px.tr36.i554, -1
%indvars.iv.next1101 = add nuw nsw i64 %indvars.iv1100, 1
%add18.i575 = add nuw nsw i32 %accumulator.tr35.i555, 1
%cmp.i576 = icmp slt i32 %px.tr36.i554, 1
br i1 %cmp.i576, label %dfs.exit577, label %lor.lhs.false.i551
dfs.exit577: ; preds = %if.end.i572, %lor.lhs.false10.i565, %lor.lhs.false.i551, %lor.lhs.false.lr.ph.i550.split.us
%.us-phi10301243 = phi i32 [ %.us-phi10301244, %lor.lhs.false.lr.ph.i550.split.us ], [ %.us-phi1030, %lor.lhs.false.i551 ], [ %.us-phi1030, %lor.lhs.false10.i565 ], [ %.us-phi1030, %if.end.i572 ]
%sub4812371241 = phi i32 [ %sub4812371242, %lor.lhs.false.lr.ph.i550.split.us ], [ %sub48, %lor.lhs.false.i551 ], [ %sub48, %lor.lhs.false10.i565 ], [ %sub48, %if.end.i572 ]
%.pre-phi = phi i32 [ %.pre1149, %lor.lhs.false.lr.ph.i550.split.us ], [ %40, %lor.lhs.false.i551 ], [ %40, %lor.lhs.false10.i565 ], [ %40, %if.end.i572 ]
%.us-phi1031 = phi i32 [ 0, %lor.lhs.false.lr.ph.i550.split.us ], [ %40, %if.end.i572 ], [ %accumulator.tr35.i555, %lor.lhs.false10.i565 ], [ %accumulator.tr35.i555, %lor.lhs.false.i551 ]
%add51 = add i32 %.us-phi10301243, -1
%sub52 = add i32 %add51, %.us-phi1031
store i32 %sub52, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 8), align 16, !tbaa !5
%cmp5.i589 = icmp sgt i32 %dec4, %8
%cmp9.i592 = icmp sgt i32 %indvars.iv1064, %8
br label %lor.lhs.false.i580
lor.lhs.false.i580: ; preds = %if.end.i601, %dfs.exit577
%ph.tr38.i581 = phi i32 [ %5, %dfs.exit577 ], [ %add17.i604, %if.end.i601 ]
%py.tr37.i582 = phi i32 [ %dec4, %dfs.exit577 ], [ %add16.i603, %if.end.i601 ]
%px.tr36.i583 = phi i32 [ %dec, %dfs.exit577 ], [ %add.i602, %if.end.i601 ]
%accumulator.tr35.i584 = phi i32 [ 0, %dfs.exit577 ], [ %add18.i605, %if.end.i601 ]
%cmp3.i586 = icmp slt i32 %py.tr37.i582, 0
%or.cond.i587 = or i1 %cmp3.i586, %cmp1.i129.fr
br i1 %or.cond.i587, label %dfs.exit607, label %lor.lhs.false4.i588
lor.lhs.false4.i588: ; preds = %lor.lhs.false.i580
%cmp7.i590 = icmp slt i32 %ph.tr38.i581, 0
%or.cond19.i591 = or i1 %cmp7.i590, %cmp5.i589
%or.cond33.i593 = or i1 %cmp9.i592, %or.cond19.i591
br i1 %or.cond33.i593, label %dfs.exit607, label %lor.lhs.false10.i594
lor.lhs.false10.i594: ; preds = %lor.lhs.false4.i588
%idxprom.i595 = zext i32 %px.tr36.i583 to i64
%idxprom11.i596 = zext i32 %py.tr37.i582 to i64
%idxprom13.i597 = zext i32 %ph.tr38.i581 to i64
%arrayidx14.i598 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i595, i64 %idxprom11.i596, i64 %idxprom13.i597
%44 = load i32, ptr %arrayidx14.i598, align 4, !tbaa !5
%cmp15.not.i599 = icmp eq i32 %44, %6
br i1 %cmp15.not.i599, label %if.end.i601, label %dfs.exit607
if.end.i601: ; preds = %lor.lhs.false10.i594
%add.i602 = add nsw i32 %px.tr36.i583, -1
%add16.i603 = add nsw i32 %py.tr37.i582, -1
%add17.i604 = add nsw i32 %ph.tr38.i581, -1
%add18.i605 = add nuw nsw i32 %accumulator.tr35.i584, 1
%cmp.i606 = icmp slt i32 %px.tr36.i583, 1
br i1 %cmp.i606, label %dfs.exit607, label %lor.lhs.false.i580
dfs.exit607: ; preds = %lor.lhs.false.i580, %lor.lhs.false4.i588, %lor.lhs.false10.i594, %if.end.i601
%accumulator.tr.lcssa.i600 = phi i32 [ %.pre-phi, %if.end.i601 ], [ %accumulator.tr35.i584, %lor.lhs.false.i580 ], [ %accumulator.tr35.i584, %lor.lhs.false4.i588 ], [ %accumulator.tr35.i584, %lor.lhs.false10.i594 ]
%45 = load i32, ptr @N, align 4, !tbaa !5
%46 = sext i32 %45 to i64
%cmp3.i616 = icmp slt i32 %.fr, 1
%cmp.i636 = icmp slt i32 %2, 0
br label %lor.lhs.false.i610
lor.lhs.false.i610: ; preds = %if.end.i631, %dfs.exit607
%indvars.iv1109 = phi i64 [ %indvars.iv.next1110, %if.end.i631 ], [ %idxprom11.i, %dfs.exit607 ]
%indvars.iv1107 = phi i64 [ %indvars.iv.next1108, %if.end.i631 ], [ %indvars.iv, %dfs.exit607 ]
%px.tr36.i613 = phi i32 [ %add.i632, %if.end.i631 ], [ %dec, %dfs.exit607 ]
%accumulator.tr35.i614 = phi i32 [ %add18.i635, %if.end.i631 ], [ 0, %dfs.exit607 ]
%cmp1.i615 = icmp slt i32 %45, %px.tr36.i613
%or.cond.i617 = or i1 %cmp3.i616, %cmp1.i615
br i1 %or.cond.i617, label %dfs.exit637, label %lor.lhs.false4.i618
lor.lhs.false4.i618: ; preds = %lor.lhs.false.i610
%47 = trunc i64 %indvars.iv1109 to i32
%cmp5.i619 = icmp slt i32 %45, %47
%cmp9.i622 = icmp sgt i64 %indvars.iv1107, %46
%or.cond33.i623 = or i1 %cmp9.i622, %cmp5.i619
br i1 %or.cond33.i623, label %dfs.exit637, label %lor.lhs.false10.i624
lor.lhs.false10.i624: ; preds = %lor.lhs.false4.i618
%idxprom.i625 = zext i32 %px.tr36.i613 to i64
%arrayidx14.i628 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i625, i64 %indvars.iv1109, i64 %indvars.iv1107
%48 = load i32, ptr %arrayidx14.i628, align 4, !tbaa !5
%cmp15.not.i629 = icmp eq i32 %48, %6
br i1 %cmp15.not.i629, label %if.end.i631, label %dfs.exit637
if.end.i631: ; preds = %lor.lhs.false10.i624
%add.i632 = add nsw i32 %px.tr36.i613, 1
%indvars.iv.next1110 = add nuw nsw i64 %indvars.iv1109, 1
%indvars.iv.next1108 = add nuw nsw i64 %indvars.iv1107, 1
%add18.i635 = add nuw nsw i32 %accumulator.tr35.i614, 1
br i1 %cmp.i636, label %dfs.exit637, label %lor.lhs.false.i610
dfs.exit637: ; preds = %lor.lhs.false.i610, %lor.lhs.false4.i618, %lor.lhs.false10.i624, %if.end.i631
%accumulator.tr.lcssa.i630 = phi i32 [ %add18.i635, %if.end.i631 ], [ %accumulator.tr35.i614, %lor.lhs.false.i610 ], [ %accumulator.tr35.i614, %lor.lhs.false4.i618 ], [ %accumulator.tr35.i614, %lor.lhs.false10.i624 ]
%add55 = add i32 %accumulator.tr.lcssa.i600, -1
%sub56 = add i32 %add55, %accumulator.tr.lcssa.i630
store i32 %sub56, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 9), align 4, !tbaa !5
%cmp5.i649 = icmp sgt i32 %dec4, %45
%cmp.i666 = icmp slt i32 %2, 0
br label %lor.lhs.false.i640
lor.lhs.false.i640: ; preds = %if.end.i661, %dfs.exit637
%indvars.iv1115 = phi i64 [ %indvars.iv.next1116, %if.end.i661 ], [ %indvars.iv, %dfs.exit637 ]
%py.tr37.i642 = phi i32 [ %add16.i663, %if.end.i661 ], [ %dec4, %dfs.exit637 ]
%px.tr36.i643 = phi i32 [ %add.i662, %if.end.i661 ], [ %dec, %dfs.exit637 ]
%accumulator.tr35.i644 = phi i32 [ %add18.i665, %if.end.i661 ], [ 0, %dfs.exit637 ]
%cmp1.i645 = icmp slt i32 %45, %px.tr36.i643
%cmp3.i646 = icmp slt i32 %py.tr37.i642, 0
%or.cond.i647 = or i1 %cmp3.i646, %cmp1.i645
%cmp9.i652 = icmp sgt i64 %indvars.iv1115, %46
%or.cond33.i653 = or i1 %cmp9.i652, %cmp5.i649
%or.cond1253 = select i1 %or.cond.i647, i1 true, i1 %or.cond33.i653
br i1 %or.cond1253, label %dfs.exit667, label %lor.lhs.false10.i654
lor.lhs.false10.i654: ; preds = %lor.lhs.false.i640
%idxprom.i655 = zext i32 %px.tr36.i643 to i64
%idxprom11.i656 = zext i32 %py.tr37.i642 to i64
%arrayidx14.i658 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i655, i64 %idxprom11.i656, i64 %indvars.iv1115
%49 = load i32, ptr %arrayidx14.i658, align 4, !tbaa !5
%cmp15.not.i659 = icmp eq i32 %49, %6
br i1 %cmp15.not.i659, label %if.end.i661, label %dfs.exit667
if.end.i661: ; preds = %lor.lhs.false10.i654
%add.i662 = add nsw i32 %px.tr36.i643, 1
%add16.i663 = add nsw i32 %py.tr37.i642, -1
%indvars.iv.next1116 = add nuw nsw i64 %indvars.iv1115, 1
%add18.i665 = add nuw nsw i32 %accumulator.tr35.i644, 1
br i1 %cmp.i666, label %dfs.exit667, label %lor.lhs.false.i640
dfs.exit667: ; preds = %lor.lhs.false.i640, %lor.lhs.false10.i654, %if.end.i661
%accumulator.tr.lcssa.i660 = phi i32 [ %add18.i665, %if.end.i661 ], [ %accumulator.tr35.i644, %lor.lhs.false.i640 ], [ %accumulator.tr35.i644, %lor.lhs.false10.i654 ]
%cmp1.i675 = icmp sgt i32 %dec, %45
%or.cond.i677 = or i1 %cmp3.i616, %cmp1.i675
%cmp9.i682 = icmp sgt i32 %indvars.iv1064, %45
br label %lor.lhs.false.i670
lor.lhs.false.i670: ; preds = %if.end.i691, %dfs.exit667
%indvars.iv1119 = phi i64 [ %indvars.iv.next1120, %if.end.i691 ], [ %idxprom11.i, %dfs.exit667 ]
%ph.tr38.i671 = phi i32 [ %add17.i694, %if.end.i691 ], [ %5, %dfs.exit667 ]
%px.tr36.i673 = phi i32 [ %add.i692, %if.end.i691 ], [ %dec, %dfs.exit667 ]
%accumulator.tr35.i674 = phi i32 [ %add18.i695, %if.end.i691 ], [ 0, %dfs.exit667 ]
br i1 %or.cond.i677, label %dfs.exit697, label %lor.lhs.false4.i678
lor.lhs.false4.i678: ; preds = %lor.lhs.false.i670
%50 = trunc i64 %indvars.iv1119 to i32
%cmp5.i679 = icmp slt i32 %45, %50
%cmp7.i680 = icmp slt i32 %ph.tr38.i671, 0
%or.cond19.i681 = or i1 %cmp7.i680, %cmp5.i679
%or.cond33.i683 = or i1 %cmp9.i682, %or.cond19.i681
br i1 %or.cond33.i683, label %dfs.exit697, label %lor.lhs.false10.i684
lor.lhs.false10.i684: ; preds = %lor.lhs.false4.i678
%idxprom.i685 = zext i32 %px.tr36.i673 to i64
%idxprom13.i687 = zext i32 %ph.tr38.i671 to i64
%arrayidx14.i688 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i685, i64 %indvars.iv1119, i64 %idxprom13.i687
%51 = load i32, ptr %arrayidx14.i688, align 4, !tbaa !5
%cmp15.not.i689 = icmp eq i32 %51, %6
br i1 %cmp15.not.i689, label %if.end.i691, label %dfs.exit697
if.end.i691: ; preds = %lor.lhs.false10.i684
%add.i692 = add nsw i32 %px.tr36.i673, -1
%indvars.iv.next1120 = add nuw nsw i64 %indvars.iv1119, 1
%add17.i694 = add nsw i32 %ph.tr38.i671, -1
%add18.i695 = add nuw nsw i32 %accumulator.tr35.i674, 1
%cmp.i696 = icmp slt i32 %px.tr36.i673, 1
br i1 %cmp.i696, label %dfs.exit697, label %lor.lhs.false.i670
dfs.exit697: ; preds = %lor.lhs.false.i670, %lor.lhs.false4.i678, %lor.lhs.false10.i684, %if.end.i691
%accumulator.tr.lcssa.i690 = phi i32 [ %.pre-phi, %if.end.i691 ], [ %accumulator.tr35.i674, %lor.lhs.false.i670 ], [ %accumulator.tr35.i674, %lor.lhs.false4.i678 ], [ %accumulator.tr35.i674, %lor.lhs.false10.i684 ]
%add59 = add i32 %accumulator.tr.lcssa.i660, -1
%sub60 = add i32 %add59, %accumulator.tr.lcssa.i690
store i32 %sub60, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 10), align 8, !tbaa !5
%cmp5.i709 = icmp sgt i32 %dec4, %45
br label %lor.lhs.false.i700
lor.lhs.false.i700: ; preds = %if.end.i721, %dfs.exit697
%indvars.iv1124 = phi i64 [ %indvars.iv.next1125, %if.end.i721 ], [ %indvars.iv, %dfs.exit697 ]
%py.tr37.i702 = phi i32 [ %add16.i723, %if.end.i721 ], [ %dec4, %dfs.exit697 ]
%px.tr36.i703 = phi i32 [ %add.i722, %if.end.i721 ], [ %dec, %dfs.exit697 ]
%accumulator.tr35.i704 = phi i32 [ %add18.i725, %if.end.i721 ], [ 0, %dfs.exit697 ]
%cmp3.i706 = icmp slt i32 %py.tr37.i702, 0
%or.cond.i707 = or i1 %cmp3.i706, %cmp1.i675
%cmp9.i712 = icmp sgt i64 %indvars.iv1124, %46
%or.cond33.i713 = or i1 %cmp9.i712, %cmp5.i709
%or.cond1254 = select i1 %or.cond.i707, i1 true, i1 %or.cond33.i713
br i1 %or.cond1254, label %dfs.exit727, label %lor.lhs.false10.i714
lor.lhs.false10.i714: ; preds = %lor.lhs.false.i700
%idxprom.i715 = zext i32 %px.tr36.i703 to i64
%idxprom11.i716 = zext i32 %py.tr37.i702 to i64
%arrayidx14.i718 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i715, i64 %idxprom11.i716, i64 %indvars.iv1124
%52 = load i32, ptr %arrayidx14.i718, align 4, !tbaa !5
%cmp15.not.i719 = icmp eq i32 %52, %6
br i1 %cmp15.not.i719, label %if.end.i721, label %dfs.exit727
if.end.i721: ; preds = %lor.lhs.false10.i714
%add.i722 = add nsw i32 %px.tr36.i703, -1
%add16.i723 = add nsw i32 %py.tr37.i702, -1
%indvars.iv.next1125 = add nuw nsw i64 %indvars.iv1124, 1
%add18.i725 = add nuw nsw i32 %accumulator.tr35.i704, 1
%cmp.i726 = icmp slt i32 %px.tr36.i703, 1
br i1 %cmp.i726, label %dfs.exit727, label %lor.lhs.false.i700
dfs.exit727: ; preds = %lor.lhs.false.i700, %lor.lhs.false10.i714, %if.end.i721
%accumulator.tr.lcssa.i720 = phi i32 [ %.pre-phi, %if.end.i721 ], [ %accumulator.tr35.i704, %lor.lhs.false.i700 ], [ %accumulator.tr35.i704, %lor.lhs.false10.i714 ]
%cmp9.i742 = icmp sgt i32 %indvars.iv1064, %45
%cmp.i756 = icmp slt i32 %2, 0
br label %lor.lhs.false.i730
lor.lhs.false.i730: ; preds = %if.end.i751, %dfs.exit727
%indvars.iv1129 = phi i64 [ %indvars.iv.next1130, %if.end.i751 ], [ %idxprom11.i, %dfs.exit727 ]
%ph.tr38.i731 = phi i32 [ %add17.i754, %if.end.i751 ], [ %5, %dfs.exit727 ]
%px.tr36.i733 = phi i32 [ %add.i752, %if.end.i751 ], [ %dec, %dfs.exit727 ]
%accumulator.tr35.i734 = phi i32 [ %add18.i755, %if.end.i751 ], [ 0, %dfs.exit727 ]
%cmp1.i735 = icmp slt i32 %45, %px.tr36.i733
%or.cond.i737 = or i1 %cmp3.i616, %cmp1.i735
br i1 %or.cond.i737, label %dfs.exit757, label %lor.lhs.false4.i738
lor.lhs.false4.i738: ; preds = %lor.lhs.false.i730
%53 = trunc i64 %indvars.iv1129 to i32
%cmp5.i739 = icmp slt i32 %45, %53
%cmp7.i740 = icmp slt i32 %ph.tr38.i731, 0
%or.cond19.i741 = or i1 %cmp7.i740, %cmp5.i739
%or.cond33.i743 = or i1 %cmp9.i742, %or.cond19.i741
br i1 %or.cond33.i743, label %dfs.exit757, label %lor.lhs.false10.i744
lor.lhs.false10.i744: ; preds = %lor.lhs.false4.i738
%idxprom.i745 = zext i32 %px.tr36.i733 to i64
%idxprom13.i747 = zext i32 %ph.tr38.i731 to i64
%arrayidx14.i748 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i745, i64 %indvars.iv1129, i64 %idxprom13.i747
%54 = load i32, ptr %arrayidx14.i748, align 4, !tbaa !5
%cmp15.not.i749 = icmp eq i32 %54, %6
br i1 %cmp15.not.i749, label %if.end.i751, label %dfs.exit757
if.end.i751: ; preds = %lor.lhs.false10.i744
%add.i752 = add nsw i32 %px.tr36.i733, 1
%indvars.iv.next1130 = add nuw nsw i64 %indvars.iv1129, 1
%add17.i754 = add nsw i32 %ph.tr38.i731, -1
%add18.i755 = add nuw nsw i32 %accumulator.tr35.i734, 1
br i1 %cmp.i756, label %dfs.exit757, label %lor.lhs.false.i730
dfs.exit757: ; preds = %lor.lhs.false.i730, %lor.lhs.false4.i738, %lor.lhs.false10.i744, %if.end.i751
%accumulator.tr.lcssa.i750 = phi i32 [ %add18.i755, %if.end.i751 ], [ %accumulator.tr35.i734, %lor.lhs.false.i730 ], [ %accumulator.tr35.i734, %lor.lhs.false4.i738 ], [ %accumulator.tr35.i734, %lor.lhs.false10.i744 ]
%add63 = add i32 %accumulator.tr.lcssa.i720, -1
%sub64 = add i32 %add63, %accumulator.tr.lcssa.i750
store i32 %sub64, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 11), align 4, !tbaa !5
%cmp5.i769 = icmp sgt i32 %dec4, %45
%cmp9.i772 = icmp sgt i32 %indvars.iv1064, %45
%cmp.i786 = icmp slt i32 %2, 0
br label %lor.lhs.false.i760
lor.lhs.false.i760: ; preds = %if.end.i781, %dfs.exit757
%ph.tr38.i761 = phi i32 [ %5, %dfs.exit757 ], [ %add17.i784, %if.end.i781 ]
%py.tr37.i762 = phi i32 [ %dec4, %dfs.exit757 ], [ %add16.i783, %if.end.i781 ]
%px.tr36.i763 = phi i32 [ %dec, %dfs.exit757 ], [ %add.i782, %if.end.i781 ]
%accumulator.tr35.i764 = phi i32 [ 0, %dfs.exit757 ], [ %add18.i785, %if.end.i781 ]
%cmp1.i765 = icmp slt i32 %45, %px.tr36.i763
%cmp3.i766 = icmp slt i32 %py.tr37.i762, 0
%or.cond.i767 = or i1 %cmp3.i766, %cmp1.i765
br i1 %or.cond.i767, label %dfs.exit787, label %lor.lhs.false4.i768
lor.lhs.false4.i768: ; preds = %lor.lhs.false.i760
%cmp7.i770 = icmp slt i32 %ph.tr38.i761, 0
%or.cond19.i771 = or i1 %cmp7.i770, %cmp5.i769
%or.cond33.i773 = or i1 %cmp9.i772, %or.cond19.i771
br i1 %or.cond33.i773, label %dfs.exit787, label %lor.lhs.false10.i774
lor.lhs.false10.i774: ; preds = %lor.lhs.false4.i768
%idxprom.i775 = zext i32 %px.tr36.i763 to i64
%idxprom11.i776 = zext i32 %py.tr37.i762 to i64
%idxprom13.i777 = zext i32 %ph.tr38.i761 to i64
%arrayidx14.i778 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i775, i64 %idxprom11.i776, i64 %idxprom13.i777
%55 = load i32, ptr %arrayidx14.i778, align 4, !tbaa !5
%cmp15.not.i779 = icmp eq i32 %55, %6
br i1 %cmp15.not.i779, label %if.end.i781, label %dfs.exit787
if.end.i781: ; preds = %lor.lhs.false10.i774
%add.i782 = add nsw i32 %px.tr36.i763, 1
%add16.i783 = add nsw i32 %py.tr37.i762, -1
%add17.i784 = add nsw i32 %ph.tr38.i761, -1
%add18.i785 = add nuw nsw i32 %accumulator.tr35.i764, 1
br i1 %cmp.i786, label %dfs.exit787, label %lor.lhs.false.i760
dfs.exit787: ; preds = %lor.lhs.false.i760, %lor.lhs.false4.i768, %lor.lhs.false10.i774, %if.end.i781
%accumulator.tr.lcssa.i780 = phi i32 [ %add18.i785, %if.end.i781 ], [ %accumulator.tr35.i764, %lor.lhs.false.i760 ], [ %accumulator.tr35.i764, %lor.lhs.false4.i768 ], [ %accumulator.tr35.i764, %lor.lhs.false10.i774 ]
br label %lor.lhs.false.i790
lor.lhs.false.i790: ; preds = %if.end.i811, %dfs.exit787
%indvars.iv1136 = phi i64 [ %indvars.iv.next1137, %if.end.i811 ], [ %idxprom11.i, %dfs.exit787 ]
%indvars.iv1134 = phi i64 [ %indvars.iv.next1135, %if.end.i811 ], [ %indvars.iv, %dfs.exit787 ]
%px.tr36.i793 = phi i32 [ %add.i812, %if.end.i811 ], [ %dec, %dfs.exit787 ]
%accumulator.tr35.i794 = phi i32 [ %add18.i815, %if.end.i811 ], [ 0, %dfs.exit787 ]
br i1 %or.cond.i677, label %dfs.exit817.loopexit, label %lor.lhs.false4.i798
lor.lhs.false4.i798: ; preds = %lor.lhs.false.i790
%56 = trunc i64 %indvars.iv1136 to i32
%cmp5.i799 = icmp slt i32 %45, %56
%cmp9.i802 = icmp sgt i64 %indvars.iv1134, %46
%or.cond33.i803 = or i1 %cmp9.i802, %cmp5.i799
br i1 %or.cond33.i803, label %dfs.exit817.loopexit, label %lor.lhs.false10.i804
lor.lhs.false10.i804: ; preds = %lor.lhs.false4.i798
%idxprom.i805 = zext i32 %px.tr36.i793 to i64
%arrayidx14.i808 = getelementptr inbounds [8 x [8 x [8 x i32]]], ptr @m, i64 0, i64 %idxprom.i805, i64 %indvars.iv1136, i64 %indvars.iv1134
%57 = load i32, ptr %arrayidx14.i808, align 4, !tbaa !5
%cmp15.not.i809 = icmp eq i32 %57, %6
br i1 %cmp15.not.i809, label %if.end.i811, label %dfs.exit817.loopexit
if.end.i811: ; preds = %lor.lhs.false10.i804
%add.i812 = add nsw i32 %px.tr36.i793, -1
%indvars.iv.next1137 = add nuw nsw i64 %indvars.iv1136, 1
%indvars.iv.next1135 = add nuw nsw i64 %indvars.iv1134, 1
%add18.i815 = add nuw nsw i32 %accumulator.tr35.i794, 1
%cmp.i816 = icmp slt i32 %px.tr36.i793, 1
br i1 %cmp.i816, label %dfs.exit817.loopexit, label %lor.lhs.false.i790
dfs.exit817.loopexit: ; preds = %if.end.i811, %lor.lhs.false10.i804, %lor.lhs.false4.i798, %lor.lhs.false.i790
%accumulator.tr.lcssa.i810.ph = phi i32 [ %accumulator.tr35.i794, %lor.lhs.false.i790 ], [ %accumulator.tr35.i794, %lor.lhs.false4.i798 ], [ %accumulator.tr35.i794, %lor.lhs.false10.i804 ], [ %.pre-phi, %if.end.i811 ]
%.pre = load i32, ptr @C, align 16, !tbaa !5
br label %dfs.exit817
dfs.exit817: ; preds = %dfs.exit817.loopexit, %dfs.exit123.thread
%58 = phi i32 [ -1, %dfs.exit123.thread ], [ %sub64, %dfs.exit817.loopexit ]
%59 = phi i32 [ -1, %dfs.exit123.thread ], [ %sub60, %dfs.exit817.loopexit ]
%60 = phi i32 [ -1, %dfs.exit123.thread ], [ %sub56, %dfs.exit817.loopexit ]
%61 = phi i32 [ -1, %dfs.exit123.thread ], [ %sub52, %dfs.exit817.loopexit ]
%62 = phi i32 [ -1, %dfs.exit123.thread ], [ %sub4812371241, %dfs.exit817.loopexit ]
%63 = phi i32 [ -1, %dfs.exit123.thread ], [ %sub44, %dfs.exit817.loopexit ]
%64 = phi i32 [ -1, %dfs.exit123.thread ], [ %sub4012141223, %dfs.exit817.loopexit ]
%65 = phi i32 [ -1, %dfs.exit123.thread ], [ %sub36, %dfs.exit817.loopexit ]
%66 = phi i32 [ -1, %dfs.exit123.thread ], [ %sub3211961201, %dfs.exit817.loopexit ]
%67 = phi i32 [ -1, %dfs.exit123.thread ], [ %sub281181118511951202, %dfs.exit817.loopexit ]
%68 = phi i32 [ -1, %dfs.exit123.thread ], [ %sub24116511681180118611941203, %dfs.exit817.loopexit ]
%69 = phi i32 [ -1, %dfs.exit123.thread ], [ %.pre, %dfs.exit817.loopexit ]
%accumulator.tr.lcssa.i780891 = phi i32 [ 0, %dfs.exit123.thread ], [ %accumulator.tr.lcssa.i780, %dfs.exit817.loopexit ]
%accumulator.tr.lcssa.i810 = phi i32 [ 0, %dfs.exit123.thread ], [ %accumulator.tr.lcssa.i810.ph, %dfs.exit817.loopexit ]
%add67 = add i32 %accumulator.tr.lcssa.i780891, -1
%sub68 = add i32 %add67, %accumulator.tr.lcssa.i810
store i32 %sub68, ptr getelementptr inbounds ([14 x i32], ptr @C, i64 0, i64 12), align 16, !tbaa !5
%70 = load i32, ptr @M, align 4, !tbaa !5
%71 = load i32, ptr @i, align 4
%cmp74.not = icmp sge i32 %69, %70
%cmp74.not.1 = icmp sge i32 %68, %70
%.not.not = or i1 %cmp74.not, %cmp74.not.1
%cmp74.not.2 = icmp sge i32 %67, %70
%72 = or i1 %.not.not, %cmp74.not.2
%cmp74.not.3 = icmp sge i32 %66, %70
%73 = or i1 %72, %cmp74.not.3
%cmp74.not.4 = icmp sge i32 %65, %70
%74 = or i1 %73, %cmp74.not.4
%cmp74.not.5 = icmp sge i32 %64, %70
%75 = or i1 %74, %cmp74.not.5
%cmp74.not.6 = icmp sge i32 %63, %70
%76 = or i1 %75, %cmp74.not.6
%cmp74.not.7 = icmp sge i32 %62, %70
%77 = or i1 %76, %cmp74.not.7
%cmp74.not.8 = icmp sge i32 %61, %70
%78 = or i1 %77, %cmp74.not.8
%cmp74.not.9 = icmp sge i32 %60, %70
%79 = or i1 %78, %cmp74.not.9
%cmp74.not.10 = icmp sge i32 %59, %70
%80 = or i1 %79, %cmp74.not.10
%cmp74.not.11 = icmp sge i32 %58, %70
%81 = or i1 %80, %cmp74.not.11
%cmp74.not.12 = icmp sge i32 %sub68, %70
%82 = or i1 %81, %cmp74.not.12
br i1 %82, label %83, label %84
83: ; preds = %dfs.exit817
store i32 %71, ptr @r, align 4, !tbaa !5
br label %84
84: ; preds = %dfs.exit817, %83
store i32 13, ptr @j, align 4, !tbaa !5
br label %for.inc80
for.inc80: ; preds = %for.end.for.inc80_crit_edge, %84
%85 = phi i32 [ %.pre1146, %for.end.for.inc80_crit_edge ], [ %71, %84 ]
%inc81 = add nsw i32 %85, 1
store i32 %inc81, ptr @i, align 4, !tbaa !5
%mul = sub nsw i32 0, %6
store i32 %mul, ptr @p, align 4, !tbaa !5
%86 = load i32, ptr @P, align 4, !tbaa !5
%cmp = icmp slt i32 %inc81, %86
br i1 %cmp, label %for.body2, label %for.end82, !llvm.loop !11
for.end82: ; preds = %for.inc80
%.pre1147 = load i32, ptr @r, align 4, !tbaa !5
%.pre1147.fr = freeze i32 %.pre1147
%cmp83 = icmp eq i32 %.pre1147.fr, 0
%87 = and i32 %.pre1147.fr, 1
%tobool84.not = icmp eq i32 %87, 0
%cond = select i1 %tobool84.not, ptr @.str.5, ptr @.str.4
br i1 %cmp83, label %for.end82.thread, label %88
for.end82.thread: ; preds = %for.body, %for.end82
br label %88
88: ; preds = %for.end82, %for.end82.thread
%89 = phi ptr [ @.str.3, %for.end82.thread ], [ %cond, %for.end82 ]
%call86 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %89)
%90 = load i32, ptr @r, align 4, !tbaa !5
%cmp87 = icmp eq i32 %90, 0
br i1 %cmp87, label %if.then88, label %if.else
if.then88: ; preds = %88
%putchar = tail call i32 @putchar(i32 10)
br label %if.end92
if.else: ; preds = %88
%add90 = add nsw i32 %90, 1
%call91 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %add90)
br label %if.end92
if.end92: ; preds = %if.else, %if.then88
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N, ptr noundef nonnull @M, ptr noundef nonnull @P)
%91 = load i32, ptr @N, align 4, !tbaa !5
%tobool.not = icmp eq i32 %91, 0
br i1 %tobool.not, label %for.end93, label %for.body, !llvm.loop !12
for.end93: ; preds = %if.end92, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(){
int N,M;
scanf("%d %d",&N,&M);
int i;
int pow2=1;
for(i=0;i<M;i++){
pow2*=2;
}
printf("%d\n",pow2*((1800*M)+(100*N)));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114324/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114324/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%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
%M = 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 %M) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i32, ptr %M, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %0, 0
br i1 %cmp7, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%xtraiter = and i32 %0, 7
%1 = icmp ult i32 %0, 8
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 i32 %0, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%pow2.09 = phi i32 [ 1, %for.body.preheader.new ], [ %mul, %for.body ]
%niter = phi i32 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = shl i32 %pow2.09, 8
%niter.next.7 = add i32 %niter, 8
%niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %mul, %for.body ]
%pow2.09.unr = phi i32 [ 1, %for.body.preheader ], [ %mul, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%pow2.09.epil = phi i32 [ %mul.epil, %for.body.epil ], [ %pow2.09.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = shl nsw i32 %pow2.09.epil, 1
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%pow2.0.lcssa = phi i32 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
%mul1 = mul nsw i32 %0, 1800
%2 = load i32, ptr %N, align 4, !tbaa !5
%mul2 = mul nsw i32 %2, 100
%add = add nsw i32 %mul2, %mul1
%mul3 = mul nsw i32 %add, %pow2.0.lcssa
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
int main(){
int a,b,c;
scanf("%d%d%d", &a,&b,&c);
for(int i=1; i<=b; i++){
if( (i*a) % b == c ){ printf("YES\n"); return 0; }
}
printf("NO\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114375/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114375/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"YES\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %b, align 4, !tbaa !5
%cmp.not10 = icmp slt i32 %0, 1
br i1 %cmp.not10, label %cleanup4, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %c, align 4, !tbaa !5
br label %for.body
for.cond: ; preds = %for.body
%inc = add nuw i32 %i.011, 1
%exitcond.not = icmp eq i32 %i.011, %0
br i1 %exitcond.not, label %cleanup4, label %for.body, !llvm.loop !9
for.body: ; preds = %for.body.lr.ph, %for.cond
%i.011 = phi i32 [ 1, %for.body.lr.ph ], [ %inc, %for.cond ]
%mul = mul nsw i32 %1, %i.011
%rem = srem i32 %mul, %0
%cmp1 = icmp eq i32 %rem, %2
br i1 %cmp1, label %cleanup4, label %for.cond
cleanup4: ; preds = %for.cond, %for.body, %entry
%str.sink = phi ptr [ @str.3, %entry ], [ @str, %for.body ], [ @str.3, %for.cond ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int A,B,C;
int i;
scanf("%d %d %d",&A,&B,&C);
for(i=1;i<=B;i++)
if(A*i%B==C) {
printf("YES");
break;
}
if(i==B+1) printf("NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114418/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114418/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %B, align 4, !tbaa !5
%cmp.not12 = icmp slt i32 %0, 1
br i1 %cmp.not12, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %A, align 4, !tbaa !5
%2 = load i32, ptr %C, align 4, !tbaa !5
%3 = add nuw i32 %0, 1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%i.013 = phi i32 [ 1, %for.body.lr.ph ], [ %inc, %for.inc ]
%mul = mul nsw i32 %1, %i.013
%rem = srem i32 %mul, %0
%cmp1 = icmp eq i32 %rem, %2
br i1 %cmp1, label %if.then, label %for.inc
if.then: ; preds = %for.body
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%.pre = load i32, ptr %B, align 4, !tbaa !5
br label %for.end
for.inc: ; preds = %for.body
%inc = add nuw i32 %i.013, 1
%exitcond.not = icmp eq i32 %i.013, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.inc, %entry, %if.then
%4 = phi i32 [ %.pre, %if.then ], [ %0, %entry ], [ %0, %for.inc ]
%i.011 = phi i32 [ %i.013, %if.then ], [ 1, %entry ], [ %3, %for.inc ]
%add = add nsw i32 %4, 1
%cmp3 = icmp eq i32 %i.011, %add
br i1 %cmp3, label %if.then4, label %if.end6
if.then4: ; preds = %for.end
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end6
if.end6: ; preds = %if.then4, %for.end
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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int A,B,C;
scanf("%d %d %d",&A,&B,&C);
for(int i = 1;i < B;i++){
if(A * i % B == C){
printf("YES");
return 0;
}
}
printf("NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114461/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114461/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %B, align 4, !tbaa !5
%cmp.not9 = icmp sgt i32 %0, 1
br i1 %cmp.not9, label %for.body.lr.ph, label %cleanup4
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %A, align 4, !tbaa !5
%2 = load i32, ptr %C, align 4, !tbaa !5
br label %for.body
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.010, 1
%exitcond.not = icmp eq i32 %inc, %0
br i1 %exitcond.not, label %cleanup4, label %for.body, !llvm.loop !9
for.body: ; preds = %for.body.lr.ph, %for.cond
%i.010 = phi i32 [ 1, %for.body.lr.ph ], [ %inc, %for.cond ]
%mul = mul nsw i32 %1, %i.010
%rem = srem i32 %mul, %0
%cmp1 = icmp eq i32 %rem, %2
br i1 %cmp1, label %cleanup4, label %for.cond
cleanup4: ; preds = %for.cond, %for.body, %entry
%.str.1.sink = phi ptr [ @.str.2, %entry ], [ @.str.1, %for.body ], [ @.str.2, %for.cond ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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)
{
size_t a, b, c;
scanf("%zu %zu %zu", &a, &b, &c);
for (size_t n = 1; n <= b; ++n) {
if ((n * a % b) % b == c) {
puts("YES");
return 0;
}
}
puts("NO");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114504/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114504/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%zu %zu %zu\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 i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 8, 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 i64, ptr %b, align 8, !tbaa !5
%cmp.not10 = icmp eq i64 %0, 0
br i1 %cmp.not10, label %cleanup5, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%1 = load i64, ptr %a, align 8, !tbaa !5
%2 = load i64, ptr %c, align 8, !tbaa !5
br label %for.body
for.cond: ; preds = %for.body
%inc = add i64 %n.011, 1
%cmp.not = icmp ugt i64 %inc, %0
br i1 %cmp.not, label %cleanup5, label %for.body, !llvm.loop !9
for.body: ; preds = %for.body.lr.ph, %for.cond
%n.011 = phi i64 [ 1, %for.body.lr.ph ], [ %inc, %for.cond ]
%mul = mul i64 %1, %n.011
%rem = urem i64 %mul, %0
%cmp2 = icmp eq i64 %rem, %2
br i1 %cmp2, label %cleanup5, label %for.cond
cleanup5: ; preds = %for.cond, %for.body, %entry
%.str.1.sink = phi ptr [ @.str.2, %entry ], [ @.str.1, %for.body ], [ @.str.2, %for.cond ]
%call3 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, 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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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>
int main(){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
a=a%b;
c=c%b;
for(int i=1;i<=b;i++){
if((a*i)%b==c){
puts("YES");
return 0;
}
}
puts("NO");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114548/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114548/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%rem = srem i32 %0, %1
store i32 %rem, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %c, align 4, !tbaa !5
%rem1 = srem i32 %2, %1
store i32 %rem1, ptr %c, align 4, !tbaa !5
%cmp.not11 = icmp slt i32 %1, 1
br i1 %cmp.not11, label %cleanup6, label %for.body
for.cond: ; preds = %for.body
%inc = add nuw i32 %i.012, 1
%exitcond.not = icmp eq i32 %i.012, %1
br i1 %exitcond.not, label %cleanup6, label %for.body, !llvm.loop !9
for.body: ; preds = %entry, %for.cond
%i.012 = phi i32 [ %inc, %for.cond ], [ 1, %entry ]
%mul = mul nsw i32 %i.012, %rem
%rem2 = srem i32 %mul, %1
%cmp3 = icmp eq i32 %rem2, %rem1
br i1 %cmp3, label %cleanup6, label %for.cond
cleanup6: ; preds = %for.cond, %for.body, %entry
%.str.1.sink = phi ptr [ @.str.2, %entry ], [ @.str.1, %for.body ], [ @.str.2, %for.cond ]
%call4 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int a, b, c, i, ans;
long sum;
scanf("%d %d %d", &a, &b, &c);
sum = a + c;
ans = 0;
for (i = 0; i < b; i++)
{
if (sum % b == 0)
{
ans = 1; break;
}
else sum += a;
}
if (ans == 1)
printf("YES");
else printf("NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114591/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114591/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %b, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body.lr.ph, label %if.end13
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %c, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
%add = add nsw i32 %1, %2
%conv = sext i32 %add to i64
%conv2 = zext i32 %0 to i64
%conv5 = sext i32 %2 to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %if.else
%sum.018 = phi i64 [ %conv, %for.body.lr.ph ], [ %add6, %if.else ]
%i.017 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %if.else ]
%rem = srem i64 %sum.018, %conv2
%cmp3 = icmp eq i64 %rem, 0
br i1 %cmp3, label %if.end13, label %if.else
if.else: ; preds = %for.body
%add6 = add nsw i64 %sum.018, %conv5
%inc = add nuw nsw i32 %i.017, 1
%exitcond.not = icmp eq i32 %inc, %0
br i1 %exitcond.not, label %if.end13, label %for.body, !llvm.loop !9
if.end13: ; preds = %if.else, %for.body, %entry
%.str.2.sink = phi ptr [ @.str.2, %entry ], [ @.str.1, %for.body ], [ @.str.2, %if.else ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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>
const int n = 100;
void insertionSort(int A[], int N);
int main(){
int i, N;
int A[n];
scanf("%d", &N);
for(i = 0; i < N; i++){
scanf("%d", &A[i]);
}
insertionSort(A, N);
return 0;
}
void insertionSort(int A[], int N){
int i, j, k, v;
for(k = 0; k < N; k++){
printf("%d", A[k]);
if(k == N-1){
printf("\n");
}else{
printf(" ");
}
}
for(i = 1; i < N; i++){
j = i-1;
v = A[i];
while(j >= 0 && A[j] > v){
A[j+1] = A[j];
j--;
}
A[j+1] = v;
for(k = 0; k < N; k++){
printf("%d", A[k]);
if(k == N-1){
printf("\n");
}else{
printf(" ");
}
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114641/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114641/source.c"
target datalayout = "e-m:e-p270: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 local_unnamed_addr constant i32 100, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%0 = tail call ptr @llvm.stacksave.p0()
%vla4 = alloca [100 x i32], align 16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%1 = load i32, ptr %N, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %1, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla4, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %1, %entry ], [ %2, %for.body ]
call void @insertionSort(ptr noundef nonnull %vla4, i32 noundef %.lcssa)
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp69 = icmp sgt i32 %N, 0
br i1 %cmp69, label %for.body.lr.ph, label %for.end39
for.body.lr.ph: ; preds = %entry
%sub = add nsw i32 %N, -1
%0 = zext i32 %sub to i64
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.cond4.preheader: ; preds = %for.body
%cmp576 = icmp sgt i32 %N, 1
br i1 %cmp576, label %for.body6.us.preheader, label %for.end39
for.body6.us.preheader: ; preds = %for.cond4.preheader
%sub27 = add nsw i32 %N, -1
%1 = zext i32 %sub27 to i64
%wide.trip.count93 = zext i32 %N to i64
br label %for.body6.us
for.body6.us: ; preds = %for.body6.us.preheader, %for.cond21.for.inc37_crit_edge.us
%indvars.iv80 = phi i64 [ 1, %for.body6.us.preheader ], [ %indvars.iv.next81, %for.cond21.for.inc37_crit_edge.us ]
%arrayidx9.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv80
%2 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body6.us
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %while.body.us ], [ %indvars.iv80, %for.body6.us ]
%indvars.iv.next83 = add nsw i64 %indvars.iv82, -1
%idxprom11.us = and i64 %indvars.iv.next83, 4294967295
%arrayidx12.us = getelementptr inbounds i32, ptr %A, i64 %idxprom11.us
%3 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%cmp13.us = icmp sgt i32 %3, %2
br i1 %cmp13.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv82, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom19.us = ashr exact i64 %sext, 32
%arrayidx20.us = getelementptr inbounds i32, ptr %A, i64 %idxprom19.us
store i32 %2, ptr %arrayidx20.us, align 4, !tbaa !5
br label %for.body23.us
for.body23.us: ; preds = %while.end.us, %for.body23.us
%indvars.iv85 = phi i64 [ 0, %while.end.us ], [ %indvars.iv.next86, %for.body23.us ]
%arrayidx25.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv85
%4 = load i32, ptr %arrayidx25.us, align 4, !tbaa !5
%call26.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%cmp28.us = icmp eq i64 %indvars.iv85, %1
%. = select i1 %cmp28.us, i32 10, i32 32
%putchar66.us = tail call i32 @putchar(i32 %.)
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%exitcond90.not = icmp eq i64 %indvars.iv.next86, %wide.trip.count93
br i1 %exitcond90.not, label %for.cond21.for.inc37_crit_edge.us, label %for.body23.us, !llvm.loop !11
while.body.us: ; preds = %land.rhs.us
%arrayidx17.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv82
store i32 %3, ptr %arrayidx17.us, align 4, !tbaa !5
%5 = icmp sgt i64 %indvars.iv82, 1
br i1 %5, label %land.rhs.us, label %while.end.us, !llvm.loop !12
for.cond21.for.inc37_crit_edge.us: ; preds = %for.body23.us
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%exitcond94.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count93
br i1 %exitcond94.not, label %for.end39, label %for.body6.us, !llvm.loop !13
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%cmp1 = icmp eq i64 %indvars.iv, %0
%.97 = select i1 %cmp1, i32 10, i32 32
%putchar68 = tail call i32 @putchar(i32 %.97)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond4.preheader, label %for.body, !llvm.loop !14
for.end39: ; preds = %for.cond21.for.inc37_crit_edge.us, %entry, %for.cond4.preheader
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
void trace(int *A, int N) {
int i;
for (i = 0; i < N; i++) {
if (i > 0) {
printf(" ");
}
printf("%d", A[i]);
}
printf("\n");
}
void insertionSort(int *A, int N) {
int i, j;
int v;
for (i = 0; i < N; i++) {
v = A[i];
j = i - 1;
while (j >= 0 && A[j] > v) {
A[j + 1] = A[j];
j--;
}
A[j + 1] = v;
trace(A, N);
}
}
int main(void) {
int N;
int A[1000];
int i;
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", &A[i]);
}
insertionSort(A, N);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114685/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114685/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @trace(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp8 = icmp sgt i32 %N, 0
br i1 %cmp8, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%.pre = load i32, ptr %A, align 4, !tbaa !5
%call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %N, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar7 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp32 = icmp sgt i32 %N, 0
br i1 %cmp32, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%wide.trip.count.i = zext i32 %N to i64
%exitcond.peel.not.i = icmp eq i32 %N, 1
br i1 %exitcond.peel.not.i, label %for.end.loopexit, label %for.body.us
for.body.us: ; preds = %for.body.lr.ph, %trace.exit.loopexit.us
%indvars.iv = phi i64 [ %indvars.iv.next, %trace.exit.loopexit.us ], [ 0, %for.body.lr.ph ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
%cmp128.us.not = icmp eq i64 %indvars.iv, 0
br i1 %cmp128.us.not, label %while.end.us, label %land.rhs.us
land.rhs.us: ; preds = %for.body.us, %while.body.us
%indvars.iv35 = phi i64 [ %indvars.iv.next36, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next36 = add nsw i64 %indvars.iv35, -1
%idxprom2.us = and i64 %indvars.iv.next36, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us
%1 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp sgt i32 %1, %0
br i1 %cmp4.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %land.rhs.us, %while.body.us, %for.body.us
%j.0.in.lcssa.us = phi i64 [ 0, %for.body.us ], [ 0, %while.body.us ], [ %indvars.iv35, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom10.us = ashr exact i64 %sext, 32
%arrayidx11.us = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us
store i32 %0, ptr %arrayidx11.us, align 4, !tbaa !5
%.pre.i.us = load i32, ptr %A, align 4, !tbaa !5
%call2.peel.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us)
br label %if.end.i.us
if.end.i.us: ; preds = %while.end.us, %if.end.i.us
%indvars.iv.i.us = phi i64 [ %indvars.iv.next.i.us, %if.end.i.us ], [ 1, %while.end.us ]
%putchar7.i.us = tail call i32 @putchar(i32 32)
%arrayidx.i.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us
%2 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%call2.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %trace.exit.loopexit.us, label %if.end.i.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv35
store i32 %1, ptr %arrayidx8.us, align 4, !tbaa !5
%3 = icmp sgt i64 %indvars.iv35, 1
br i1 %3, label %land.rhs.us, label %while.end.us, !llvm.loop !12
trace.exit.loopexit.us: ; preds = %if.end.i.us
%putchar.i.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count.i
br i1 %exitcond.not, label %for.end, label %for.body.us, !llvm.loop !13
for.end.loopexit: ; preds = %for.body.lr.ph
%.pre.i.us.us = load i32, ptr %A, align 4, !tbaa !5
%call2.peel.i.us.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us.us)
%putchar.i.us.us = tail call i32 @putchar(i32 10)
br label %for.end
for.end: ; preds = %trace.exit.loopexit.us, %for.end.loopexit, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %0, 0
br i1 %cmp4, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @insertionSort(ptr noundef nonnull %A, i32 noundef %.lcssa)
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main(){
int i,n,v,j,k;
int *A;
scanf("%d", &n);
A = (int *)malloc(n*sizeof(int)); //配列を確保
for(i=0; i<n; i++) scanf("%d", A+i); //配列Aに値を入力
for(i=0; i<n; i++){
v = A[i]; //仮置き
j = i-1;
while(j>=0 && A[j]>v){ //iよりも前の要素と比較
A[j+1] = A[j]; //一つ右にずらす
j--;
}
A[j+1] = v;
//結果出力
for(k=0; k<n-1; k++) printf("%d ", A[k]);
printf("%d\n", A[n-1]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114728/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114728/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #5
%cmp60 = icmp sgt i32 %0, 0
br i1 %cmp60, label %for.body, label %for.end38
for.cond4.preheader: ; preds = %for.body
%cmp571 = icmp sgt i32 %1, 0
br i1 %cmp571, label %for.body7, label %for.end38
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.body7: ; preds = %for.cond4.preheader, %for.end31
%3 = phi i32 [ %11, %for.end31 ], [ %1, %for.cond4.preheader ]
%indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.end31 ], [ 0, %for.cond4.preheader ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv75
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp863.not = icmp eq i64 %indvars.iv75, 0
br i1 %cmp863.not, label %while.end, label %land.rhs
land.rhs: ; preds = %for.body7, %while.body
%indvars.iv77 = phi i64 [ %indvars.iv.next78, %while.body ], [ %indvars.iv75, %for.body7 ]
%indvars.iv.next78 = add nsw i64 %indvars.iv77, -1
%idxprom10 = and i64 %indvars.iv.next78, 4294967295
%arrayidx11 = getelementptr inbounds i32, ptr %call1, i64 %idxprom10
%5 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %5, %4
br i1 %cmp12, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx17 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv77
store i32 %5, ptr %arrayidx17, align 4, !tbaa !5
%6 = icmp sgt i64 %indvars.iv77, 1
br i1 %6, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %land.rhs, %while.body, %for.body7
%j.0.in.lcssa = phi i64 [ 0, %for.body7 ], [ 0, %while.body ], [ %indvars.iv77, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom19 = ashr exact i64 %sext, 32
%arrayidx20 = getelementptr inbounds i32, ptr %call1, i64 %idxprom19
store i32 %4, ptr %arrayidx20, align 4, !tbaa !5
%cmp2368 = icmp sgt i32 %3, 1
br i1 %cmp2368, label %for.body25, label %while.end.for.end31_crit_edge
while.end.for.end31_crit_edge: ; preds = %while.end
%sub2267 = add nsw i32 %3, -1
%.pre = sext i32 %sub2267 to i64
br label %for.end31
for.body25: ; preds = %while.end, %for.body25
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.body25 ], [ 0, %while.end ]
%arrayidx27 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv80
%7 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%sub22 = add nsw i32 %8, -1
%9 = sext i32 %sub22 to i64
%cmp23 = icmp slt i64 %indvars.iv.next81, %9
br i1 %cmp23, label %for.body25, label %for.end31, !llvm.loop !12
for.end31: ; preds = %for.body25, %while.end.for.end31_crit_edge
%idxprom33.pre-phi = phi i64 [ %.pre, %while.end.for.end31_crit_edge ], [ %9, %for.body25 ]
%arrayidx34 = getelementptr inbounds i32, ptr %call1, i64 %idxprom33.pre-phi
%10 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp5 = icmp slt i64 %indvars.iv.next76, %12
br i1 %cmp5, label %for.body7, label %for.end38, !llvm.loop !13
for.end38: ; preds = %for.end31, %entry, %for.cond4.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { nounwind }
attributes #5 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <string.h>
#define BUF_SIZE 10000
#define ARRAY_SIZE 1000
void print_array(int array[], int size){
int i;
for(i = 0; i < size; i++){
if(i > 0) printf(" ");
printf("%d", array[i]);
}
printf("\n");
return;
}
void insersion_sort(int array[], int size)
{
int i, j, v;
for(i = 1; i < size; i++){
v = array[i];
j = i - 1;
while((j >= 0) && (array[j] > v)){
array[j+1] = array[j];
j--;
}
array[j+1] = v;
print_array(array, size);
}
return ;
}
int main(void)
{
char buf[BUF_SIZE];
char *ptr;
int input_size;
int array[ARRAY_SIZE];
int i;
fgets(buf, BUF_SIZE, stdin);
sscanf(buf, "%d", &input_size);
fgets(buf, BUF_SIZE, stdin);
ptr = strtok(buf, " ");
for(i = 0; i < input_size; i++){
sscanf(ptr, "%d", &array[i]);
ptr = strtok(NULL, " ");
}
print_array(array, input_size);
insersion_sort(array, input_size);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114807/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114807/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [2 x i8] c" \00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_array(ptr nocapture noundef readonly %array, i32 noundef %size) local_unnamed_addr #0 {
entry:
%cmp8 = icmp sgt i32 %size, 0
br i1 %cmp8, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %size to i64
%.pre = load i32, ptr %array, align 4, !tbaa !5
%call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %size, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar7 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insersion_sort(ptr nocapture noundef %array, i32 noundef %size) local_unnamed_addr #0 {
entry:
%cmp30 = icmp sgt i32 %size, 1
br i1 %cmp30, label %for.body.us.preheader, label %for.end
for.body.us.preheader: ; preds = %entry
%wide.trip.count.i = zext i32 %size to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %print_array.exit.loopexit.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %print_array.exit.loopexit.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next35 = add nsw i64 %indvars.iv34, -1
%idxprom2.us = and i64 %indvars.iv.next35, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %array, i64 %idxprom2.us
%1 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp sgt i32 %1, %0
br i1 %cmp4.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv34, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom10.us = ashr exact i64 %sext, 32
%arrayidx11.us = getelementptr inbounds i32, ptr %array, i64 %idxprom10.us
store i32 %0, ptr %arrayidx11.us, align 4, !tbaa !5
%.pre.i.us = load i32, ptr %array, align 4, !tbaa !5
%call2.peel.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us)
br label %if.end.i.us
if.end.i.us: ; preds = %while.end.us, %if.end.i.us
%indvars.iv.i.us = phi i64 [ %indvars.iv.next.i.us, %if.end.i.us ], [ 1, %while.end.us ]
%putchar7.i.us = tail call i32 @putchar(i32 32)
%arrayidx.i.us = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i.us
%2 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%call2.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %print_array.exit.loopexit.us, label %if.end.i.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %array, i64 %indvars.iv34
store i32 %1, ptr %arrayidx8.us, align 4, !tbaa !5
%3 = icmp sgt i64 %indvars.iv34, 1
br i1 %3, label %land.rhs.us, label %while.end.us, !llvm.loop !12
print_array.exit.loopexit.us: ; preds = %if.end.i.us
%putchar.i.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count.i
br i1 %exitcond.not, label %for.end, label %for.body.us, !llvm.loop !13
for.end: ; preds = %print_array.exit.loopexit.us, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%buf = alloca [10000 x i8], align 16
%input_size = alloca i32, align 4
%array = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %buf) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %input_size) #5
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %array) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !14
%call = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 10000, ptr noundef %0)
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %buf, ptr noundef nonnull @.str.1, ptr noundef nonnull %input_size) #5
%1 = load ptr, ptr @stdin, align 8, !tbaa !14
%call4 = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 10000, ptr noundef %1)
%call6 = call ptr @strtok(ptr noundef nonnull %buf, ptr noundef nonnull @.str) #5
%2 = load i32, ptr %input_size, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %2, 0
br i1 %cmp16, label %for.body, label %print_array.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%ptr.017 = phi ptr [ %call8, %for.body ], [ %call6, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %array, i64 0, i64 %indvars.iv
%call7 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %ptr.017, ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) #5
%call8 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str) #5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %input_size, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !16
for.end: ; preds = %for.body
%cmp8.i = icmp sgt i32 %3, 0
br i1 %cmp8.i, label %if.end.peel.i, label %print_array.exit
if.end.peel.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %3 to i64
%.pre.i = load i32, ptr %array, align 16, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %3, 1
br i1 %exitcond.peel.not.i, label %print_array.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar7.i = call i32 @putchar(i32 32)
%arrayidx.i = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %print_array.exit, label %if.end.i, !llvm.loop !9
print_array.exit: ; preds = %if.end.i, %entry, %for.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%6 = load i32, ptr %input_size, align 4, !tbaa !5
%cmp30.i = icmp sgt i32 %6, 1
br i1 %cmp30.i, label %for.body.us.preheader.i, label %insersion_sort.exit
for.body.us.preheader.i: ; preds = %print_array.exit
%wide.trip.count.i.i = zext i32 %6 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %print_array.exit.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv.i13 = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i14, %print_array.exit.loopexit.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i13
%7 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv34.i = phi i64 [ %indvars.iv.next35.i, %while.body.us.i ], [ %indvars.iv.i13, %for.body.us.i ]
%indvars.iv.next35.i = add nsw i64 %indvars.iv34.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next35.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr %array, i64 %idxprom2.us.i
%8 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp sgt i32 %8, %7
br i1 %cmp4.us.i, label %while.body.us.i, label %while.end.us.i
while.end.us.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv34.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom10.us.i = ashr exact i64 %sext.i, 32
%arrayidx11.us.i = getelementptr inbounds i32, ptr %array, i64 %idxprom10.us.i
store i32 %7, ptr %arrayidx11.us.i, align 4, !tbaa !5
%.pre.i.us.i = load i32, ptr %array, align 16, !tbaa !5
%call2.peel.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us.i)
br label %if.end.i.us.i
if.end.i.us.i: ; preds = %if.end.i.us.i, %while.end.us.i
%indvars.iv.i.us.i = phi i64 [ %indvars.iv.next.i.us.i, %if.end.i.us.i ], [ 1, %while.end.us.i ]
%putchar7.i.us.i = call i32 @putchar(i32 32)
%arrayidx.i.us.i = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i.us.i
%9 = load i32, ptr %arrayidx.i.us.i, align 4, !tbaa !5
%call2.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
%indvars.iv.next.i.us.i = add nuw nsw i64 %indvars.iv.i.us.i, 1
%exitcond.not.i.us.i = icmp eq i64 %indvars.iv.next.i.us.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.us.i, label %print_array.exit.loopexit.us.i, label %if.end.i.us.i, !llvm.loop !9
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr %array, i64 %indvars.iv34.i
store i32 %8, ptr %arrayidx8.us.i, align 4, !tbaa !5
%10 = icmp sgt i64 %indvars.iv34.i, 1
br i1 %10, label %land.rhs.us.i, label %while.end.us.i, !llvm.loop !12
print_array.exit.loopexit.us.i: ; preds = %if.end.i.us.i
%putchar.i.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i14 = add nuw nsw i64 %indvars.iv.i13, 1
%exitcond.not.i15 = icmp eq i64 %indvars.iv.next.i14, %wide.trip.count.i.i
br i1 %exitcond.not.i15, label %insersion_sort.exit, label %for.body.us.i, !llvm.loop !13
insersion_sort.exit: ; preds = %print_array.exit.loopexit.us.i, %print_array.exit
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %array) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %input_size) #5
call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %buf) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn
declare ptr @strtok(ptr noundef, ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void printOut(int *numArray, int listNum)
{
int i;
for (i = 0; i < listNum; i++) {
if (i == listNum - 1) {
printf("%d\n", numArray[i]);
}
else {
printf("%d ", numArray[i]);
}
}
}
void insertionSort(int *A, int N)
{
int i;
for (i = 1; i <= N - 1; i++) {
int v = A[i];
int j = i - 1;
while (j >= 0 && A[j] > v) {
A[j + 1] = A[j];
j--;
}
A[j + 1] = v;
printOut(A, N);
}
}
int main(int argc, char** argv)
{
int N, i;
int numlist[100];
memset(numlist, '\0', sizeof(numlist));
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", &numlist[i]);
}
printOut(numlist, N);
insertionSort(numlist, N);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114850/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114850/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @printOut(ptr nocapture noundef readonly %numArray, i32 noundef %listNum) local_unnamed_addr #0 {
entry:
%cmp11 = icmp sgt i32 %listNum, 0
br i1 %cmp11, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%sub = add nsw i32 %listNum, -1
%0 = zext i32 %sub to i64
%wide.trip.count = zext i32 %listNum to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%cmp1 = icmp eq i64 %indvars.iv, %0
%arrayidx.sink = getelementptr inbounds i32, ptr %numArray, i64 %indvars.iv
%.str.sink = select i1 %cmp1, ptr @.str, ptr @.str.1
%1 = load i32, ptr %arrayidx.sink, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.sink, i32 noundef %1)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp.not.not31 = icmp sgt i32 %N, 1
br i1 %cmp.not.not31, label %for.body.us.preheader, label %for.end
for.body.us.preheader: ; preds = %entry
%sub.i = add nsw i32 %N, -1
%0 = zext i32 %sub.i to i64
%wide.trip.count.i = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %printOut.exit.loopexit.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %printOut.exit.loopexit.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next35 = add nsw i64 %indvars.iv34, -1
%idxprom3.us = and i64 %indvars.iv.next35, 4294967295
%arrayidx4.us = getelementptr inbounds i32, ptr %A, i64 %idxprom3.us
%2 = load i32, ptr %arrayidx4.us, align 4, !tbaa !5
%cmp5.us = icmp sgt i32 %2, %1
br i1 %cmp5.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv34, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom11.us = ashr exact i64 %sext, 32
%arrayidx12.us = getelementptr inbounds i32, ptr %A, i64 %idxprom11.us
store i32 %1, ptr %arrayidx12.us, align 4, !tbaa !5
br label %for.body.i.us
for.body.i.us: ; preds = %for.body.i.us, %while.end.us
%indvars.iv.i.us = phi i64 [ 0, %while.end.us ], [ %indvars.iv.next.i.us, %for.body.i.us ]
%cmp1.i.us = icmp eq i64 %indvars.iv.i.us, %0
%arrayidx.sink.i.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us
%.str.sink.i.us = select i1 %cmp1.i.us, ptr @.str, ptr @.str.1
%3 = load i32, ptr %arrayidx.sink.i.us, align 4, !tbaa !5
%call.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.sink.i.us, i32 noundef %3)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %printOut.exit.loopexit.us, label %for.body.i.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx9.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv34
store i32 %2, ptr %arrayidx9.us, align 4, !tbaa !5
%4 = icmp sgt i64 %indvars.iv34, 1
br i1 %4, label %land.rhs.us, label %while.end.us, !llvm.loop !11
printOut.exit.loopexit.us: ; preds = %for.body.i.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count.i
br i1 %exitcond.not, label %for.end, label %for.body.us, !llvm.loop !12
for.end: ; preds = %printOut.exit.loopexit.us, %entry
ret void
}
; 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
%numlist = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %numlist) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %numlist, i8 0, i64 400, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %insertionSort.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %numlist, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body
%cmp11.i = icmp sgt i32 %1, 0
br i1 %cmp11.i, label %for.body.lr.ph.i, label %insertionSort.exit
for.body.lr.ph.i: ; preds = %for.end
%sub.i = add nsw i32 %1, -1
%3 = zext i32 %sub.i to i64
%wide.trip.count.i = zext i32 %1 to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.lr.ph.i
%indvars.iv.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next.i, %for.body.i ]
%cmp1.i = icmp eq i64 %indvars.iv.i, %3
%arrayidx.sink.i = getelementptr inbounds i32, ptr %numlist, i64 %indvars.iv.i
%.str.sink.i = select i1 %cmp1.i, ptr @.str, ptr @.str.1
%4 = load i32, ptr %arrayidx.sink.i, align 4, !tbaa !5
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.sink.i, i32 noundef %4)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %printOut.exit, label %for.body.i, !llvm.loop !9
printOut.exit: ; preds = %for.body.i
%.pr = load i32, ptr %N, align 4, !tbaa !5
%cmp.not.not31.i = icmp sgt i32 %.pr, 1
br i1 %cmp.not.not31.i, label %for.body.us.preheader.i, label %insertionSort.exit
for.body.us.preheader.i: ; preds = %printOut.exit
%sub.i.i = add nsw i32 %.pr, -1
%5 = zext i32 %sub.i.i to i64
%wide.trip.count.i.i = zext i32 %.pr to i64
br label %for.body.us.i
for.body.us.i: ; preds = %printOut.exit.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv.i6 = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i7, %printOut.exit.loopexit.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %numlist, i64 %indvars.iv.i6
%6 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv34.i = phi i64 [ %indvars.iv.next35.i, %while.body.us.i ], [ %indvars.iv.i6, %for.body.us.i ]
%indvars.iv.next35.i = add nsw i64 %indvars.iv34.i, -1
%idxprom3.us.i = and i64 %indvars.iv.next35.i, 4294967295
%arrayidx4.us.i = getelementptr inbounds i32, ptr %numlist, i64 %idxprom3.us.i
%7 = load i32, ptr %arrayidx4.us.i, align 4, !tbaa !5
%cmp5.us.i = icmp sgt i32 %7, %6
br i1 %cmp5.us.i, label %while.body.us.i, label %while.end.us.i
while.end.us.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv34.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom11.us.i = ashr exact i64 %sext.i, 32
%arrayidx12.us.i = getelementptr inbounds i32, ptr %numlist, i64 %idxprom11.us.i
store i32 %6, ptr %arrayidx12.us.i, align 4, !tbaa !5
br label %for.body.i.us.i
for.body.i.us.i: ; preds = %for.body.i.us.i, %while.end.us.i
%indvars.iv.i.us.i = phi i64 [ 0, %while.end.us.i ], [ %indvars.iv.next.i.us.i, %for.body.i.us.i ]
%cmp1.i.us.i = icmp eq i64 %indvars.iv.i.us.i, %5
%arrayidx.sink.i.us.i = getelementptr inbounds i32, ptr %numlist, i64 %indvars.iv.i.us.i
%.str.sink.i.us.i = select i1 %cmp1.i.us.i, ptr @.str, ptr @.str.1
%8 = load i32, ptr %arrayidx.sink.i.us.i, align 4, !tbaa !5
%call.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.sink.i.us.i, i32 noundef %8)
%indvars.iv.next.i.us.i = add nuw nsw i64 %indvars.iv.i.us.i, 1
%exitcond.not.i.us.i = icmp eq i64 %indvars.iv.next.i.us.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.us.i, label %printOut.exit.loopexit.us.i, label %for.body.i.us.i, !llvm.loop !9
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx9.us.i = getelementptr inbounds i32, ptr %numlist, i64 %indvars.iv34.i
store i32 %7, ptr %arrayidx9.us.i, align 4, !tbaa !5
%9 = icmp sgt i64 %indvars.iv34.i, 1
br i1 %9, label %land.rhs.us.i, label %while.end.us.i, !llvm.loop !11
printOut.exit.loopexit.us.i: ; preds = %for.body.i.us.i
%indvars.iv.next.i7 = add nuw nsw i64 %indvars.iv.i6, 1
%exitcond.not.i8 = icmp eq i64 %indvars.iv.next.i7, %wide.trip.count.i.i
br i1 %exitcond.not.i8, label %insertionSort.exit, label %for.body.us.i, !llvm.loop !12
insertionSort.exit: ; preds = %printOut.exit.loopexit.us.i, %entry, %for.end, %printOut.exit
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %numlist) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
static const int N = 1000;
void trace(int A[], int n)
{
int i;
for ( i = 1; i <= n; i++ ){
if ( i > 1 ) printf(" ");
printf("%d", A[i]);
}
printf("\n");
}
int main()
{
int n, i, j, key;
int A[N+1];
scanf("%d", &n);
for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
trace(A, n);
for(i = 2; i <= n; i++){
key = A[i];
j = i -1;
while(j >= 0 && A[j] > key){
A[j+1] = A[j];
j--;
A[j+1] = key;
}
trace(A, n);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114894/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114894/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @trace(ptr nocapture noundef readonly %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp.not8 = icmp slt i32 %n, 1
br i1 %cmp.not8, label %for.end, label %if.end.peel
if.end.peel: ; preds = %entry
%0 = add nuw i32 %n, 1
%wide.trip.count = zext i32 %0 to i64
%arrayidx.peel.phi.trans.insert = getelementptr inbounds i32, ptr %A, i64 1
%.pre = load i32, ptr %arrayidx.peel.phi.trans.insert, align 4, !tbaa !5
%call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %0, 2
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 2, %if.end.peel ]
%putchar7 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%0 = tail call ptr @llvm.stacksave.p0()
%vla35 = alloca [1001 x i32], align 16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not52 = icmp slt i32 %1, 1
br i1 %cmp.not52, label %trace.exit, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla35, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body
%cmp.not8.i = icmp slt i32 %2, 1
br i1 %cmp.not8.i, label %trace.exit, label %if.end.peel.i
if.end.peel.i: ; preds = %for.end
%4 = add nuw nsw i32 %2, 1
%wide.trip.count.i = zext i32 %4 to i64
%arrayidx.peel.phi.trans.insert.i = getelementptr inbounds i32, ptr %vla35, i64 1
%.pre.i = load i32, ptr %arrayidx.peel.phi.trans.insert.i, align 4, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %4, 2
br i1 %exitcond.peel.not.i, label %trace.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 2, %if.end.peel.i ]
%putchar7.i = call i32 @putchar(i32 32)
%arrayidx.i = getelementptr inbounds i32, ptr %vla35, i64 %indvars.iv.i
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %trace.exit, label %if.end.i, !llvm.loop !9
trace.exit: ; preds = %if.end.i, %entry, %for.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.not57 = icmp slt i32 %6, 2
br i1 %cmp3.not57, label %for.end20, label %for.body4.lr.ph
for.body4.lr.ph: ; preds = %trace.exit
%arrayidx.peel.phi.trans.insert.i39 = getelementptr inbounds i32, ptr %vla35, i64 1
br label %for.body4
for.body4: ; preds = %for.body4.lr.ph, %trace.exit51
%indvars.iv61 = phi i64 [ 2, %for.body4.lr.ph ], [ %indvars.iv.next62, %trace.exit51 ]
%7 = phi i32 [ %6, %for.body4.lr.ph ], [ %13, %trace.exit51 ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla35, i64 %indvars.iv61
%8 = load i32, ptr %arrayidx6, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body4, %while.body
%indvars.iv63 = phi i64 [ %indvars.iv61, %for.body4 ], [ %indvars.iv.next64, %while.body ]
%indvars.iv.next64 = add nsw i64 %indvars.iv63, -1
%idxprom8 = and i64 %indvars.iv.next64, 4294967295
%arrayidx9 = getelementptr inbounds i32, ptr %vla35, i64 %idxprom8
%9 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %9, %8
br i1 %cmp10, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds i32, ptr %vla35, i64 %indvars.iv63
store i32 %9, ptr %arrayidx14, align 4, !tbaa !5
store i32 %8, ptr %arrayidx9, align 4, !tbaa !5
%10 = icmp sgt i64 %indvars.iv63, 1
br i1 %10, label %land.rhs, label %while.end, !llvm.loop !13
while.end: ; preds = %while.body, %land.rhs
%cmp.not8.i36 = icmp slt i32 %7, 1
br i1 %cmp.not8.i36, label %trace.exit51, label %if.end.peel.i37
if.end.peel.i37: ; preds = %while.end
%11 = add nuw i32 %7, 1
%wide.trip.count.i38 = zext i32 %11 to i64
%.pre.i40 = load i32, ptr %arrayidx.peel.phi.trans.insert.i39, align 4, !tbaa !5
%call2.peel.i41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i40)
%exitcond.peel.not.i42 = icmp eq i32 %11, 2
br i1 %exitcond.peel.not.i42, label %trace.exit51, label %if.end.i43
if.end.i43: ; preds = %if.end.peel.i37, %if.end.i43
%indvars.iv.i44 = phi i64 [ %indvars.iv.next.i48, %if.end.i43 ], [ 2, %if.end.peel.i37 ]
%putchar7.i45 = call i32 @putchar(i32 32)
%arrayidx.i46 = getelementptr inbounds i32, ptr %vla35, i64 %indvars.iv.i44
%12 = load i32, ptr %arrayidx.i46, align 4, !tbaa !5
%call2.i47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
%indvars.iv.next.i48 = add nuw nsw i64 %indvars.iv.i44, 1
%exitcond.not.i49 = icmp eq i64 %indvars.iv.next.i48, %wide.trip.count.i38
br i1 %exitcond.not.i49, label %trace.exit51, label %if.end.i43, !llvm.loop !9
trace.exit51: ; preds = %if.end.i43, %while.end, %if.end.peel.i37
%putchar.i50 = call i32 @putchar(i32 10)
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%13 = load i32, ptr %n, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp3.not.not = icmp slt i64 %indvars.iv61, %14
br i1 %cmp3.not.not, label %for.body4, label %for.end20, !llvm.loop !14
for.end20: ; preds = %trace.exit51, %trace.exit
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(){
int N,i,j,v,A[1001];
scanf("%d",&N); /*Input value of N*/
for(i=0;i<N;i++)
scanf("%d",&A[i]);/*Input value of A[]*/
for(j=0;j<N-1;j++)
printf("%d ",A[j]);
printf("%d\n",A[j]);
for(i=1;i<N;i++){/*From 1 to N-1*/
v=A[i];
j=i-1;
while(j>=0 && A[j]>v){
A[j+1]=A[j];
j--;
A[j+1]=v;
}
for(j=0;j<N-1;j++)
printf("%d ",A[j]);
printf("%d\n",A[j]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114937/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114937/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [1001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp68 = icmp sgt i32 %0, 0
br i1 %cmp68, label %for.body, label %for.end10
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 1
br i1 %1, label %for.body4, label %for.end10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1001 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [1001 x i32], ptr %A, i64 0, i64 %indvars.iv83
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next84, %6
br i1 %cmp3, label %for.body4, label %for.end10.loopexit, !llvm.loop !11
for.end10.loopexit: ; preds = %for.body4
%7 = and i64 %indvars.iv.next84, 4294967295
br label %for.end10
for.end10: ; preds = %entry, %for.end10.loopexit, %for.cond2.preheader
%j.0.lcssa = phi i64 [ 0, %for.cond2.preheader ], [ %7, %for.end10.loopexit ], [ 0, %entry ]
%arrayidx12 = getelementptr inbounds [1001 x i32], ptr %A, i64 0, i64 %j.0.lcssa
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%9 = load i32, ptr %N, align 4, !tbaa !5
%cmp1580 = icmp sgt i32 %9, 1
br i1 %cmp1580, label %for.body16, label %for.end46
for.body16: ; preds = %for.end10, %for.end40
%10 = phi i32 [ %18, %for.end40 ], [ %9, %for.end10 ]
%indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.end40 ], [ 1, %for.end10 ]
%arrayidx18 = getelementptr inbounds [1001 x i32], ptr %A, i64 0, i64 %indvars.iv86
%11 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body16, %while.body
%indvars.iv88 = phi i64 [ %indvars.iv86, %for.body16 ], [ %indvars.iv.next89, %while.body ]
%indvars.iv.next89 = add nsw i64 %indvars.iv88, -1
%idxprom21 = and i64 %indvars.iv.next89, 4294967295
%arrayidx22 = getelementptr inbounds [1001 x i32], ptr %A, i64 0, i64 %idxprom21
%12 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %12, %11
br i1 %cmp23, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx27 = getelementptr inbounds [1001 x i32], ptr %A, i64 0, i64 %indvars.iv88
store i32 %12, ptr %arrayidx27, align 4, !tbaa !5
store i32 %11, ptr %arrayidx22, align 4, !tbaa !5
%13 = icmp sgt i64 %indvars.iv88, 1
br i1 %13, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%cmp3377 = icmp sgt i32 %10, 1
br i1 %cmp3377, label %for.body34, label %for.end40
for.body34: ; preds = %while.end, %for.body34
%indvars.iv91 = phi i64 [ %indvars.iv.next92, %for.body34 ], [ 0, %while.end ]
%arrayidx36 = getelementptr inbounds [1001 x i32], ptr %A, i64 0, i64 %indvars.iv91
%14 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%15 = load i32, ptr %N, align 4, !tbaa !5
%sub32 = add nsw i32 %15, -1
%16 = sext i32 %sub32 to i64
%cmp33 = icmp slt i64 %indvars.iv.next92, %16
br i1 %cmp33, label %for.body34, label %for.end40, !llvm.loop !13
for.end40: ; preds = %for.body34, %while.end
%j.2.lcssa = phi i64 [ 0, %while.end ], [ %indvars.iv.next92, %for.body34 ]
%idxprom41 = and i64 %j.2.lcssa, 4294967295
%arrayidx42 = getelementptr inbounds [1001 x i32], ptr %A, i64 0, i64 %idxprom41
%17 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%18 = load i32, ptr %N, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp15 = icmp slt i64 %indvars.iv.next87, %19
br i1 %cmp15, label %for.body16, label %for.end46, !llvm.loop !14
for.end46: ; preds = %for.end40, %for.end10
call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main()
{
int i,j,k,l,v,N;
int A[100];
scanf("%d",&N);
for(i=0;i<N;i++) scanf("%d",&A[i]);
for(i=0;i<N;i++){
printf("%d",A[i]);
if(i != N-1)printf(" ");
}
printf("\n");
for(i=1;i<N;i++){
v = A[i];
j = i-1;
while(j >=0 && A[j] > v){
A[j+1] = A[j];
j--;
A[j+1] = v;
}
for(k=0;k<N;k++){
printf("%d",A[k]);
if(k != N-1) printf(" ");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114980/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114980/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp72 = icmp sgt i32 %0, 0
br i1 %cmp72, label %for.body, label %for.end12
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, label %for.end12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.inc10
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.inc10 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv84
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = zext i32 %sub to i64
%cmp8.not = icmp eq i64 %indvars.iv84, %6
br i1 %cmp8.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body4
%putchar71 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next85, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.inc10, %entry, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%9 = load i32, ptr %N, align 4, !tbaa !5
%cmp1581 = icmp sgt i32 %9, 1
br i1 %cmp1581, label %for.body16, label %for.end48
for.body16: ; preds = %for.end12, %for.end44
%10 = phi i32 [ %19, %for.end44 ], [ %9, %for.end12 ]
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.end44 ], [ 1, %for.end12 ]
%arrayidx18 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv87
%11 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body16, %while.body
%indvars.iv89 = phi i64 [ %indvars.iv87, %for.body16 ], [ %indvars.iv.next90, %while.body ]
%indvars.iv.next90 = add nsw i64 %indvars.iv89, -1
%idxprom21 = and i64 %indvars.iv.next90, 4294967295
%arrayidx22 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom21
%12 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %12, %11
br i1 %cmp23, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx27 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv89
store i32 %12, ptr %arrayidx27, align 4, !tbaa !5
store i32 %11, ptr %arrayidx22, align 4, !tbaa !5
%13 = icmp sgt i64 %indvars.iv89, 1
br i1 %13, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%cmp3279 = icmp sgt i32 %10, 0
br i1 %cmp3279, label %for.body33, label %for.end44
for.body33: ; preds = %while.end, %for.inc42
%indvars.iv92 = phi i64 [ %indvars.iv.next93, %for.inc42 ], [ 0, %while.end ]
%arrayidx35 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv92
%14 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %14)
%15 = load i32, ptr %N, align 4, !tbaa !5
%sub37 = add nsw i32 %15, -1
%16 = zext i32 %sub37 to i64
%cmp38.not = icmp eq i64 %indvars.iv92, %16
br i1 %cmp38.not, label %for.inc42, label %if.then39
if.then39: ; preds = %for.body33
%putchar70 = call i32 @putchar(i32 32)
%.pre98 = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc42
for.inc42: ; preds = %for.body33, %if.then39
%17 = phi i32 [ %15, %for.body33 ], [ %.pre98, %if.then39 ]
%indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
%18 = sext i32 %17 to i64
%cmp32 = icmp slt i64 %indvars.iv.next93, %18
br i1 %cmp32, label %for.body33, label %for.end44, !llvm.loop !13
for.end44: ; preds = %for.inc42, %while.end
%putchar69 = call i32 @putchar(i32 10)
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%19 = load i32, ptr %N, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp15 = icmp slt i64 %indvars.iv.next88, %20
br i1 %cmp15, label %for.body16, label %for.end48, !llvm.loop !14
for.end48: ; preds = %for.end44, %for.end12
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(void)
{
int i,j,k,v,N;
int A[1000];
scanf("%d",&N);
for(i = 0;i < N;i++){
scanf("%d",&A[i]);
}
for(i = 1;i <= N - 1;i++){
for(k = 0;k < N;k++){
if(k > 0)printf(" ");
printf("%d",A[k]);
}
printf("\n");
v = A[i];
j = i - 1;
while(j >= 0 && A[j] > v){
A[j + 1] = A[j];
j--;
}
A[j + 1] = v;
}
for(i = 0;i < N;i++){
if(i > 0)printf(" ");
printf("%d",A[i]);
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115037/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115037/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp70 = icmp sgt i32 %0, 0
br i1 %cmp70, label %for.body, label %for.end46
for.cond2.preheader: ; preds = %for.body
%cmp3.not.not77 = icmp sgt i32 %1, 1
br i1 %cmp3.not.not77, label %for.cond5.preheader, label %for.cond34.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond2.preheader, %while.end
%3 = phi i32 [ %13, %while.end ], [ %1, %for.cond2.preheader ]
%indvars.iv86 = phi i64 [ %indvars.iv.next87, %while.end ], [ 1, %for.cond2.preheader ]
%cmp672 = icmp sgt i32 %3, 0
br i1 %cmp672, label %if.end.peel, label %for.end15
if.end.peel: ; preds = %for.cond5.preheader
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call12.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp6.peel = icmp sgt i32 %4, 1
br i1 %cmp6.peel, label %if.end, label %for.end15
for.cond34.preheader: ; preds = %while.end, %for.cond2.preheader
%5 = phi i32 [ %1, %for.cond2.preheader ], [ %13, %while.end ]
%cmp3579 = icmp sgt i32 %5, 0
br i1 %cmp3579, label %if.end40.peel, label %for.end46
if.end40.peel: ; preds = %for.cond34.preheader
%.pre98 = load i32, ptr %A, align 16, !tbaa !5
%call43.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre98)
%6 = load i32, ptr %N, align 4, !tbaa !5
%cmp35.peel = icmp sgt i32 %6, 1
br i1 %cmp35.peel, label %if.end40, label %for.end46
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %if.end ], [ 1, %if.end.peel ]
%putchar69 = call i32 @putchar(i32 32)
%arrayidx11 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv82
%7 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%8 = load i32, ptr %N, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp6 = icmp slt i64 %indvars.iv.next83, %9
br i1 %cmp6, label %if.end, label %for.end15, !llvm.loop !11
for.end15: ; preds = %if.end, %if.end.peel, %for.cond5.preheader
%putchar68 = call i32 @putchar(i32 10)
%arrayidx18 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv86
%10 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.end15, %while.body
%indvars.iv88 = phi i64 [ %indvars.iv86, %for.end15 ], [ %indvars.iv.next89, %while.body ]
%indvars.iv.next89 = add nsw i64 %indvars.iv88, -1
%idxprom21 = and i64 %indvars.iv.next89, 4294967295
%arrayidx22 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom21
%11 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %11, %10
br i1 %cmp23, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx27 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv88
store i32 %11, ptr %arrayidx27, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv88, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !13
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv88, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom29 = ashr exact i64 %sext, 32
%arrayidx30 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom29
store i32 %10, ptr %arrayidx30, align 4, !tbaa !5
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%13 = load i32, ptr %N, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp3.not.not = icmp slt i64 %indvars.iv.next87, %14
br i1 %cmp3.not.not, label %for.cond5.preheader, label %for.cond34.preheader, !llvm.loop !14
if.end40: ; preds = %if.end40.peel, %if.end40
%indvars.iv93 = phi i64 [ %indvars.iv.next94, %if.end40 ], [ 1, %if.end40.peel ]
%putchar67 = call i32 @putchar(i32 32)
%arrayidx42 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv93
%15 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %15)
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%16 = load i32, ptr %N, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp35 = icmp slt i64 %indvars.iv.next94, %17
br i1 %cmp35, label %if.end40, label %for.end46, !llvm.loop !15
for.end46: ; preds = %if.end40, %entry, %if.end40.peel, %for.cond34.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !12}
|
#include <stdio.h>
int main(void)
{
int A[100], i, j, k, l, N, v;
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", &A[i]);
}
for (l = 0; l < N; l++) {
if (l < N - 1) {
printf("%d ", A[l]);
} else {
printf("%d\n", A[l]);
}
}
for (i = 1; i < N; i++) {
v = A[i];
for (j = 0; j < i; j++) {
if (A[j] > A[i]) {
for (k = i - 1; k >= j; k--) {
A[k + 1] = A[k];
}
A[j] = v;
}
}
for (l = 0; l < N; l++) {
if (l < N - 1) {
printf("%d ", A[l]);
} else {
printf("%d\n", A[l]);
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115080/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115080/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [100 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp90 = icmp sgt i32 %0, 0
br i1 %cmp90, label %for.body, label %for.end64
for.cond2.preheader: ; preds = %for.body
%cmp392 = icmp sgt i32 %1, 0
br i1 %cmp392, label %for.body4, label %for.end64
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond15.preheader: ; preds = %for.body4
%cmp16100 = icmp sgt i32 %6, 1
br i1 %cmp16100, label %for.body17, label %for.end64
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv103 = phi i64 [ %indvars.iv.next104, %for.body4 ], [ 0, %for.cond2.preheader ]
%3 = phi i32 [ %6, %for.body4 ], [ %1, %for.cond2.preheader ]
%sub = add nsw i32 %3, -1
%4 = sext i32 %sub to i64
%cmp5 = icmp slt i64 %indvars.iv103, %4
%arrayidx7 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv103
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%.str.1..str.2 = select i1 %cmp5, ptr @.str.1, ptr @.str.2
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2, i32 noundef %5)
%indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
%6 = load i32, ptr %N, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next104, %7
br i1 %cmp3, label %for.body4, label %for.cond15.preheader, !llvm.loop !11
for.body17: ; preds = %for.cond15.preheader, %for.inc62
%8 = phi i32 [ %18, %for.inc62 ], [ %6, %for.cond15.preheader ]
%indvars.iv109 = phi i64 [ %indvars.iv.next110, %for.inc62 ], [ 1, %for.cond15.preheader ]
%arrayidx19 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv109
%9 = load i32, ptr %arrayidx19, align 4, !tbaa !5
br label %for.body22
for.cond45.preheader: ; preds = %for.inc42
%cmp4698 = icmp sgt i32 %8, 0
br i1 %cmp4698, label %for.body47, label %for.cond45.preheader.for.inc62_crit_edge
for.cond45.preheader.for.inc62_crit_edge: ; preds = %for.cond45.preheader
%.pre = sext i32 %8 to i64
br label %for.inc62
for.body22: ; preds = %for.body17, %for.inc42
%indvars.iv114 = phi i64 [ 0, %for.body17 ], [ %indvars.iv.next115, %for.inc42 ]
%arrayidx24 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv114
%10 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%11 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %10, %11
br i1 %cmp27, label %for.body32, label %for.inc42
for.body32: ; preds = %for.body22, %for.body32
%indvars.iv111 = phi i64 [ %indvars.iv.next112, %for.body32 ], [ %indvars.iv109, %for.body22 ]
%indvars.iv.next112 = add nsw i64 %indvars.iv111, -1
%arrayidx34 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next112
%12 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%arrayidx36 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv111
store i32 %12, ptr %arrayidx36, align 4, !tbaa !5
%cmp31.not.not = icmp sgt i64 %indvars.iv.next112, %indvars.iv114
br i1 %cmp31.not.not, label %for.body32, label %for.end38, !llvm.loop !12
for.end38: ; preds = %for.body32
store i32 %9, ptr %arrayidx24, align 4, !tbaa !5
br label %for.inc42
for.inc42: ; preds = %for.body22, %for.end38
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%exitcond.not = icmp eq i64 %indvars.iv.next115, %indvars.iv109
br i1 %exitcond.not, label %for.cond45.preheader, label %for.body22, !llvm.loop !13
for.body47: ; preds = %for.cond45.preheader, %for.body47
%indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.body47 ], [ 0, %for.cond45.preheader ]
%13 = phi i32 [ %16, %for.body47 ], [ %8, %for.cond45.preheader ]
%sub48 = add nsw i32 %13, -1
%14 = sext i32 %sub48 to i64
%cmp49 = icmp slt i64 %indvars.iv117, %14
%arrayidx52 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv117
%15 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%.str.1..str.2127 = select i1 %cmp49, ptr @.str.1, ptr @.str.2
%call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2127, i32 noundef %15)
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%16 = load i32, ptr %N, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp46 = icmp slt i64 %indvars.iv.next118, %17
br i1 %cmp46, label %for.body47, label %for.inc62, !llvm.loop !14
for.inc62: ; preds = %for.body47, %for.cond45.preheader.for.inc62_crit_edge
%.pre-phi = phi i64 [ %.pre, %for.cond45.preheader.for.inc62_crit_edge ], [ %17, %for.body47 ]
%18 = phi i32 [ %8, %for.cond45.preheader.for.inc62_crit_edge ], [ %16, %for.body47 ]
%indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
%cmp16 = icmp slt i64 %indvars.iv.next110, %.pre-phi
br i1 %cmp16, label %for.body17, label %for.end64, !llvm.loop !15
for.end64: ; preds = %for.inc62, %entry, %for.cond2.preheader, %for.cond15.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int main(void){
int N,n,i,j,k,v;
int A[100];
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&n);
A[i] = n;
}
//printf("do");
for(k=0;k<N-1;k++){
printf("%d ",A[k]);
}
printf("%d\n",A[k]);
for(i=1;i<N;i++){
v = A[i];
j = i-1;
while(j>=0&&A[j]>v){
A[j+1] = A[j];
j--;
A[j+1] = v;
}
for(k=0;k<N-1;k++){
printf("%d ",A[k]);
}
printf("%d\n",A[k]);;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115123/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115123/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%n = alloca i32, align 4
%A = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp67 = icmp sgt i32 %0, 0
br i1 %cmp67, label %for.body, label %for.end10
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %3, 1
br i1 %1, label %for.body4, label %for.end10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%2 = load i32, ptr %n, align 4, !tbaa !5
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
store i32 %2, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv82
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%6 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%7 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next83, %7
br i1 %cmp3, label %for.body4, label %for.end10.loopexit, !llvm.loop !11
for.end10.loopexit: ; preds = %for.body4
%8 = and i64 %indvars.iv.next83, 4294967295
br label %for.end10
for.end10: ; preds = %entry, %for.end10.loopexit, %for.cond2.preheader
%k.0.lcssa = phi i64 [ 0, %for.cond2.preheader ], [ %8, %for.end10.loopexit ], [ 0, %entry ]
%arrayidx12 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %k.0.lcssa
%9 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%10 = load i32, ptr %N, align 4, !tbaa !5
%cmp1579 = icmp sgt i32 %10, 1
br i1 %cmp1579, label %for.body16, label %for.end46
for.body16: ; preds = %for.end10, %for.end40
%11 = phi i32 [ %19, %for.end40 ], [ %10, %for.end10 ]
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.end40 ], [ 1, %for.end10 ]
%arrayidx18 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv85
%12 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body16, %while.body
%indvars.iv87 = phi i64 [ %indvars.iv85, %for.body16 ], [ %indvars.iv.next88, %while.body ]
%indvars.iv.next88 = add nsw i64 %indvars.iv87, -1
%idxprom21 = and i64 %indvars.iv.next88, 4294967295
%arrayidx22 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom21
%13 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %13, %12
br i1 %cmp23, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx27 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv87
store i32 %13, ptr %arrayidx27, align 4, !tbaa !5
store i32 %12, ptr %arrayidx22, align 4, !tbaa !5
%14 = icmp sgt i64 %indvars.iv87, 1
br i1 %14, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%cmp3376 = icmp sgt i32 %11, 1
br i1 %cmp3376, label %for.body34, label %for.end40
for.body34: ; preds = %while.end, %for.body34
%indvars.iv90 = phi i64 [ %indvars.iv.next91, %for.body34 ], [ 0, %while.end ]
%arrayidx36 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv90
%15 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %15)
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%16 = load i32, ptr %N, align 4, !tbaa !5
%sub32 = add nsw i32 %16, -1
%17 = sext i32 %sub32 to i64
%cmp33 = icmp slt i64 %indvars.iv.next91, %17
br i1 %cmp33, label %for.body34, label %for.end40, !llvm.loop !13
for.end40: ; preds = %for.body34, %while.end
%k.1.lcssa = phi i64 [ 0, %while.end ], [ %indvars.iv.next91, %for.body34 ]
%idxprom41 = and i64 %k.1.lcssa, 4294967295
%arrayidx42 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom41
%18 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%19 = load i32, ptr %N, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp15 = icmp slt i64 %indvars.iv.next86, %20
br i1 %cmp15, label %for.body16, label %for.end46, !llvm.loop !14
for.end46: ; preds = %for.end40, %for.end10
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main(void){
int A[100],i,j,k,N,v;
scanf("%d",&N);
for(i=0;i<N;i++) scanf("%d",&A[i]);
for(i=1;i<=N-1;i++){
for(k=0;k<N;k++){
printf("%d",A[k]);
if(k!=N-1) printf(" ");
}
printf("\n");
v=A[i];
j=i-1;
while(j>=0 && A[j]>v){
A[j+1]=A[j];
j--;
A[j+1]=v;
}
}
for(i=0;i<N;i++){
printf("%d",A[i]);
if(i!=N-1) printf(" ");
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115167/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115167/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [100 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %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
%cmp73 = icmp sgt i32 %0, 0
br i1 %cmp73, label %for.body, label %for.end48
for.cond2.preheader: ; preds = %for.body
%cmp3.not.not80 = icmp sgt i32 %1, 1
br i1 %cmp3.not.not80, label %for.cond5.preheader, label %for.cond35.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond2.preheader, %for.inc32
%3 = phi i32 [ %13, %for.inc32 ], [ %1, %for.cond2.preheader ]
%indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.inc32 ], [ 1, %for.cond2.preheader ]
%cmp675 = icmp sgt i32 %3, 0
br i1 %cmp675, label %for.body7, label %for.end16
for.cond35.preheader: ; preds = %for.inc32, %for.cond2.preheader
%4 = phi i32 [ %1, %for.cond2.preheader ], [ %13, %for.inc32 ]
%cmp3682 = icmp sgt i32 %4, 0
br i1 %cmp3682, label %for.body37, label %for.end48
for.body7: ; preds = %for.cond5.preheader, %for.inc14
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.inc14 ], [ 0, %for.cond5.preheader ]
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv85
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%6 = load i32, ptr %N, align 4, !tbaa !5
%sub11 = add nsw i32 %6, -1
%7 = zext i32 %sub11 to i64
%cmp12.not = icmp eq i64 %indvars.iv85, %7
br i1 %cmp12.not, label %for.inc14, label %if.then
if.then: ; preds = %for.body7
%putchar72 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc14
for.inc14: ; preds = %for.body7, %if.then
%8 = phi i32 [ %6, %for.body7 ], [ %.pre, %if.then ]
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%9 = sext i32 %8 to i64
%cmp6 = icmp slt i64 %indvars.iv.next86, %9
br i1 %cmp6, label %for.body7, label %for.end16, !llvm.loop !11
for.end16: ; preds = %for.inc14, %for.cond5.preheader
%putchar71 = call i32 @putchar(i32 10)
%arrayidx19 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv88
%10 = load i32, ptr %arrayidx19, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.end16, %while.body
%indvars.iv90 = phi i64 [ %indvars.iv88, %for.end16 ], [ %indvars.iv.next91, %while.body ]
%indvars.iv.next91 = add nsw i64 %indvars.iv90, -1
%idxprom22 = and i64 %indvars.iv.next91, 4294967295
%arrayidx23 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom22
%11 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp sgt i32 %11, %10
br i1 %cmp24, label %while.body, label %for.inc32
while.body: ; preds = %land.rhs
%arrayidx28 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv90
store i32 %11, ptr %arrayidx28, align 4, !tbaa !5
store i32 %10, ptr %arrayidx23, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv90, 1
br i1 %12, label %land.rhs, label %for.inc32, !llvm.loop !12
for.inc32: ; preds = %land.rhs, %while.body
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%13 = load i32, ptr %N, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp3.not.not = icmp slt i64 %indvars.iv.next89, %14
br i1 %cmp3.not.not, label %for.cond5.preheader, label %for.cond35.preheader, !llvm.loop !13
for.body37: ; preds = %for.cond35.preheader, %for.inc46
%indvars.iv95 = phi i64 [ %indvars.iv.next96, %for.inc46 ], [ 0, %for.cond35.preheader ]
%arrayidx39 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv95
%15 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %15)
%16 = load i32, ptr %N, align 4, !tbaa !5
%sub41 = add nsw i32 %16, -1
%17 = zext i32 %sub41 to i64
%cmp42.not = icmp eq i64 %indvars.iv95, %17
br i1 %cmp42.not, label %for.inc46, label %if.then43
if.then43: ; preds = %for.body37
%putchar70 = call i32 @putchar(i32 32)
%.pre99 = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc46
for.inc46: ; preds = %for.body37, %if.then43
%18 = phi i32 [ %16, %for.body37 ], [ %.pre99, %if.then43 ]
%indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
%19 = sext i32 %18 to i64
%cmp36 = icmp slt i64 %indvars.iv.next96, %19
br i1 %cmp36, label %for.body37, label %for.end48, !llvm.loop !14
for.end48: ; preds = %for.inc46, %entry, %for.cond35.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define SORT(a,n) qsort(a,n,sizeof(int),intcmp)
#define s(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define sl(n) scanf("%I64d",&n)
#define sf(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
#define fill(a,v) memset(a, v, sizeof(a))
int intcmp(const void *f,const void *s)
{
return (*(int *)f -*(int *)s);
}
int gcd(int a,int b){ return ((b==0)?a:gcd(b,a%b));}
#define MAX 112345
#define MODBY 1000000007
typedef long long int lld;
typedef long double Lf;
int preprocess()
{
#line 1 "preprocess"
return 0;
}
int main()
{
#line 1 "main"
int cases;
int i,j,n;
int a[MAX];
scanf("%d",&n);
for(i=0;i<n;++i) s(a[i]);
int ans=a[0]+1;
for(i=1;i<n;++i)
ans+=abs(a[i]-a[i-1])+1+1;
printf("%d\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11521/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11521/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @intcmp(ptr nocapture noundef readonly %f, ptr nocapture noundef readonly %s) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %f, align 4, !tbaa !5
%1 = load i32, ptr %s, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%cmp4 = icmp eq i32 %b, 0
br i1 %cmp4, label %cond.end, label %cond.false
cond.false: ; preds = %entry, %cond.false
%b.tr6 = phi i32 [ %rem, %cond.false ], [ %b, %entry ]
%a.tr5 = phi i32 [ %b.tr6, %cond.false ], [ %a, %entry ]
%rem = srem i32 %a.tr5, %b.tr6
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %cond.end, label %cond.false
cond.end: ; preds = %cond.false, %entry
%a.tr.lcssa = phi i32 [ %a, %entry ], [ %b.tr6, %cond.false ]
ret i32 %a.tr.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @preprocess() local_unnamed_addr #2 {
entry:
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%a = alloca [112345 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 449380, ptr nonnull %a) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp25)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [112345 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%.pre = load i32, ptr %a, align 16, !tbaa !5
%add = add nsw i32 %.pre, 1
%cmp427 = icmp sgt i32 %1, 1
br i1 %cmp427, label %for.body5.preheader, label %for.end16
for.body5.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %1 to i64
%3 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %1, 9
br i1 %min.iters.check, label %for.body5.preheader42, label %vector.ph
vector.ph: ; preds = %for.body5.preheader
%n.vec = and i64 %3, -8
%ind.end = or i64 %n.vec, 1
%vector.recur.init = insertelement <4 x i32> poison, i32 %.pre, i64 3
%4 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %add, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %wide.load41, %vector.body ]
%vec.phi = phi <4 x i32> [ %4, %vector.ph ], [ %15, %vector.body ]
%vec.phi40 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ]
%offset.idx = or i64 %index, 1
%5 = getelementptr inbounds [112345 x i32], ptr %a, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load41 = load <4 x i32>, ptr %6, align 4, !tbaa !5
%7 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%8 = shufflevector <4 x i32> %wide.load, <4 x i32> %wide.load41, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%9 = sub nsw <4 x i32> %wide.load, %7
%10 = sub nsw <4 x i32> %wide.load41, %8
%11 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %9, i1 true)
%12 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %10, i1 true)
%13 = add <4 x i32> %vec.phi, <i32 2, i32 2, i32 2, i32 2>
%14 = add <4 x i32> %vec.phi40, <i32 2, i32 2, i32 2, i32 2>
%15 = add <4 x i32> %13, %11
%16 = add <4 x i32> %14, %12
%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 !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %16, %15
%18 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %3, %n.vec
%vector.recur.extract = extractelement <4 x i32> %wide.load41, i64 3
br i1 %cmp.n, label %for.end16, label %for.body5.preheader42
for.body5.preheader42: ; preds = %for.body5.preheader, %middle.block
%scalar.recur.ph = phi i32 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body5.preheader ]
%indvars.iv33.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body5.preheader ]
%ans.029.ph = phi i32 [ %18, %middle.block ], [ %add, %for.body5.preheader ]
br label %for.body5
for.body5: ; preds = %for.body5.preheader42, %for.body5
%scalar.recur = phi i32 [ %19, %for.body5 ], [ %scalar.recur.ph, %for.body5.preheader42 ]
%indvars.iv33 = phi i64 [ %indvars.iv.next34, %for.body5 ], [ %indvars.iv33.ph, %for.body5.preheader42 ]
%ans.029 = phi i32 [ %add13, %for.body5 ], [ %ans.029.ph, %for.body5.preheader42 ]
%arrayidx7 = getelementptr inbounds [112345 x i32], ptr %a, i64 0, i64 %indvars.iv33
%19 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%sub10 = sub nsw i32 %19, %scalar.recur
%20 = call i32 @llvm.abs.i32(i32 %sub10, i1 true)
%add12 = add i32 %ans.029, 2
%add13 = add i32 %add12, %20
%indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
%exitcond.not = icmp eq i64 %indvars.iv.next34, %wide.trip.count
br i1 %exitcond.not, label %for.end16, label %for.body5, !llvm.loop !14
for.end16: ; preds = %for.body5, %middle.block, %for.end
%ans.0.lcssa = phi i32 [ %add, %for.end ], [ %18, %middle.block ], [ %add13, %for.body5 ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 449380, ptr nonnull %a) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1 immarg) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #8
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
|
#include <stdio.h>
void listElements(int*, int);
int main() {
int i = 0, j, n, key;
int num[100];
scanf("%d ", &n);
while((scanf("%d", &num[i])) != EOF) {
i++;
}
for (i = 1; i < n; i++) {
listElements(num, n);
key = num[i];
j = i -1;
while(j >= 0 && num[j] > key) {
num[j+1] = num[j];
j--;
}
num[j+1] = key;
}
listElements(num, n);
return 0;
}
void listElements(int *num, int n) {
int i;
for(i = 0; i < n; i++) {
if (i == (n-1)) {
printf("%d\n", num[i]);
break;
}
printf("%d ", num[i]);
}
return;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115253/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115253/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%num = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %num) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%cmp.not = icmp eq i32 %call1, -1
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %for.cond.preheader, label %while.cond, !llvm.loop !5
for.cond.preheader: ; preds = %while.cond
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp252 = icmp sgt i32 %0, 1
br i1 %cmp252, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %while.end15
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %while.end15 ], [ 1, %for.cond.preheader ]
%1 = phi i32 [ %8, %while.end15 ], [ %0, %for.cond.preheader ]
%cmp12.i = icmp sgt i32 %1, 0
br i1 %cmp12.i, label %for.body.lr.ph.i, label %listElements.exit
for.body.lr.ph.i: ; preds = %for.body
%sub.i = add nsw i32 %1, -1
%2 = zext i32 %sub.i to i64
%cmp1.i47 = icmp eq i32 %sub.i, 0
br i1 %cmp1.i47, label %if.then.i, label %if.end.i
if.then.i: ; preds = %if.end.i, %for.body.lr.ph.i
%arrayidx.i = getelementptr inbounds i32, ptr %num, i64 %2
%3 = load i32, ptr %arrayidx.i, align 4, !tbaa !7
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %3)
br label %listElements.exit
if.end.i: ; preds = %for.body.lr.ph.i, %if.end.i
%indvars.iv.i48 = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 0, %for.body.lr.ph.i ]
%arrayidx3.i = getelementptr inbounds i32, ptr %num, i64 %indvars.iv.i48
%4 = load i32, ptr %arrayidx3.i, align 4, !tbaa !7
%call4.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i48, 1
%cmp1.i = icmp eq i64 %indvars.iv.next.i, %2
br i1 %cmp1.i, label %if.then.i, label %if.end.i
listElements.exit: ; preds = %for.body, %if.then.i
%arrayidx4 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %indvars.iv58
%5 = load i32, ptr %arrayidx4, align 4, !tbaa !7
br label %land.rhs
land.rhs: ; preds = %listElements.exit, %while.body10
%indvars.iv60 = phi i64 [ %indvars.iv58, %listElements.exit ], [ %indvars.iv.next61, %while.body10 ]
%indvars.iv.next61 = add nsw i64 %indvars.iv60, -1
%idxprom7 = and i64 %indvars.iv.next61, 4294967295
%arrayidx8 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom7
%6 = load i32, ptr %arrayidx8, align 4, !tbaa !7
%cmp9 = icmp sgt i32 %6, %5
br i1 %cmp9, label %while.body10, label %while.end15
while.body10: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %indvars.iv60
store i32 %6, ptr %arrayidx14, align 4, !tbaa !7
%7 = icmp sgt i64 %indvars.iv60, 1
br i1 %7, label %land.rhs, label %while.end15, !llvm.loop !11
while.end15: ; preds = %while.body10, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body10 ], [ %indvars.iv60, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom17 = ashr exact i64 %sext, 32
%arrayidx18 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom17
store i32 %5, ptr %arrayidx18, align 4, !tbaa !7
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%8 = load i32, ptr %n, align 4, !tbaa !7
%9 = sext i32 %8 to i64
%cmp2 = icmp slt i64 %indvars.iv.next59, %9
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %while.end15, %for.cond.preheader
%.lcssa = phi i32 [ %0, %for.cond.preheader ], [ %8, %while.end15 ]
%cmp12.i33 = icmp sgt i32 %.lcssa, 0
br i1 %cmp12.i33, label %for.body.lr.ph.i34, label %listElements.exit46
for.body.lr.ph.i34: ; preds = %for.end
%sub.i35 = add nsw i32 %.lcssa, -1
%10 = zext i32 %sub.i35 to i64
%cmp1.i3854 = icmp eq i32 %sub.i35, 0
br i1 %cmp1.i3854, label %if.then.i43, label %if.end.i39
if.then.i43: ; preds = %if.end.i39, %for.body.lr.ph.i34
%arrayidx.i44 = getelementptr inbounds i32, ptr %num, i64 %10
%11 = load i32, ptr %arrayidx.i44, align 4, !tbaa !7
%call.i45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
br label %listElements.exit46
if.end.i39: ; preds = %for.body.lr.ph.i34, %if.end.i39
%indvars.iv.i3755 = phi i64 [ %indvars.iv.next.i42, %if.end.i39 ], [ 0, %for.body.lr.ph.i34 ]
%arrayidx3.i40 = getelementptr inbounds i32, ptr %num, i64 %indvars.iv.i3755
%12 = load i32, ptr %arrayidx3.i40, align 4, !tbaa !7
%call4.i41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %12)
%indvars.iv.next.i42 = add nuw nsw i64 %indvars.iv.i3755, 1
%cmp1.i38 = icmp eq i64 %indvars.iv.next.i42, %10
br i1 %cmp1.i38, label %if.then.i43, label %if.end.i39
listElements.exit46: ; preds = %for.end, %if.then.i43
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %num) #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 uwtable
define dso_local void @listElements(ptr nocapture noundef readonly %num, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp12 = icmp sgt i32 %n, 0
br i1 %cmp12, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%sub = add nsw i32 %n, -1
%0 = zext i32 %sub to i64
%cmp116 = icmp eq i32 %sub, 0
br i1 %cmp116, label %if.then, label %if.end
if.then: ; preds = %if.end, %for.body.lr.ph
%arrayidx = getelementptr inbounds i32, ptr %num, i64 %0
%1 = load i32, ptr %arrayidx, align 4, !tbaa !7
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %1)
br label %for.end
if.end: ; preds = %for.body.lr.ph, %if.end
%indvars.iv17 = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %for.body.lr.ph ]
%arrayidx3 = getelementptr inbounds i32, ptr %num, i64 %indvars.iv17
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !7
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv17, 1
%cmp1 = icmp eq i64 %indvars.iv.next, %0
br i1 %cmp1, label %if.then, label %if.end
for.end: ; preds = %entry, %if.then
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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
|
#include<stdio.h>
int main(){
int i,j,k,m,Kazu[100],sum,key;
scanf("%d",&j);
for(i=0;i<j;i++)
{
scanf("%d",&Kazu[i]);
}
for(i=1;i<j;i++)
{
key = Kazu[i];
for(k=0;k<j;k++)
{
printf("%d",Kazu[k]);
if(k<j-1)printf(" ");
}
m=i;
while(m > 0 && Kazu[m-1] > key)
{
Kazu[m]=Kazu[m-1];
m--;
Kazu[m]=key;
}
printf("\n");
}
for(k=0;k<j;k++)
{
printf("%d",Kazu[k]);
if(k<j-1)printf(" ");
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115303/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115303/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%j = alloca i32, align 4
%Kazu = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %Kazu) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %j)
%0 = load i32, ptr %j, align 4, !tbaa !5
%cmp72 = icmp sgt i32 %0, 0
br i1 %cmp72, label %for.body, label %for.end47
for.cond2.preheader: ; preds = %for.body
%cmp377 = icmp sgt i32 %1, 1
br i1 %cmp377, label %for.body4, label %for.cond34.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %Kazu, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %j, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond34.preheader: ; preds = %while.end, %for.cond2.preheader
%3 = phi i32 [ %1, %for.cond2.preheader ], [ %13, %while.end ]
%cmp3579 = icmp sgt i32 %3, 0
br i1 %cmp3579, label %for.body36, label %for.end47
for.body4: ; preds = %for.cond2.preheader, %while.end
%4 = phi i32 [ %13, %while.end ], [ %1, %for.cond2.preheader ]
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %while.end ], [ 1, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %Kazu, i64 0, i64 %indvars.iv85
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp874 = icmp sgt i32 %4, 0
br i1 %cmp874, label %for.body9, label %land.rhs.preheader
for.body9: ; preds = %for.body4, %for.inc15
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %for.inc15 ], [ 0, %for.body4 ]
%arrayidx11 = getelementptr inbounds [100 x i32], ptr %Kazu, i64 0, i64 %indvars.iv82
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%7 = load i32, ptr %j, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%8 = sext i32 %sub to i64
%cmp13 = icmp slt i64 %indvars.iv82, %8
br i1 %cmp13, label %if.then, label %for.inc15
if.then: ; preds = %for.body9
%putchar71 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %j, align 4, !tbaa !5
br label %for.inc15
for.inc15: ; preds = %for.body9, %if.then
%9 = phi i32 [ %7, %for.body9 ], [ %.pre, %if.then ]
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%10 = sext i32 %9 to i64
%cmp8 = icmp slt i64 %indvars.iv.next83, %10
br i1 %cmp8, label %for.body9, label %land.rhs.preheader, !llvm.loop !11
land.rhs.preheader: ; preds = %for.inc15, %for.body4
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %while.body
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %while.body ], [ %indvars.iv85, %land.rhs.preheader ]
%indvars.iv.next88 = add nsw i64 %indvars.iv87, -1
%idxprom20 = and i64 %indvars.iv.next88, 4294967295
%arrayidx21 = getelementptr inbounds [100 x i32], ptr %Kazu, i64 0, i64 %idxprom20
%11 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %11, %5
br i1 %cmp22, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx27 = getelementptr inbounds [100 x i32], ptr %Kazu, i64 0, i64 %indvars.iv87
store i32 %11, ptr %arrayidx27, align 4, !tbaa !5
store i32 %5, ptr %arrayidx21, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv87, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%putchar70 = call i32 @putchar(i32 10)
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%13 = load i32, ptr %j, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp3 = icmp slt i64 %indvars.iv.next86, %14
br i1 %cmp3, label %for.body4, label %for.cond34.preheader, !llvm.loop !13
for.body36: ; preds = %for.cond34.preheader, %for.inc45
%indvars.iv92 = phi i64 [ %indvars.iv.next93, %for.inc45 ], [ 0, %for.cond34.preheader ]
%arrayidx38 = getelementptr inbounds [100 x i32], ptr %Kazu, i64 0, i64 %indvars.iv92
%15 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %15)
%16 = load i32, ptr %j, align 4, !tbaa !5
%sub40 = add nsw i32 %16, -1
%17 = sext i32 %sub40 to i64
%cmp41 = icmp slt i64 %indvars.iv92, %17
br i1 %cmp41, label %if.then42, label %for.inc45
if.then42: ; preds = %for.body36
%putchar69 = call i32 @putchar(i32 32)
%.pre96 = load i32, ptr %j, align 4, !tbaa !5
br label %for.inc45
for.inc45: ; preds = %for.body36, %if.then42
%18 = phi i32 [ %16, %for.body36 ], [ %.pre96, %if.then42 ]
%indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
%19 = sext i32 %18 to i64
%cmp35 = icmp slt i64 %indvars.iv.next93, %19
br i1 %cmp35, label %for.body36, label %for.end47, !llvm.loop !14
for.end47: ; preds = %for.inc45, %entry, %for.cond34.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %Kazu) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
static const int N = 1000;
void trace(int A[], int n){
int i;
for ( i = 1; i <= n; i++ ){
if ( i > 1 ) printf(" ");
printf("%d", A[i]);
}
printf("\n");
}
int main(){
int n, i, j,v;
int A[N+1];
scanf("%d", &n);
for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
trace(A, n);
for(i=2;i<=n;i++){
v=A[i];
j=i-1;
while(j>=0 && A[j]>v){
A[j+1] = A[j];
j--;
A[j+1] = v;
}
trace(A, n);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115347/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115347/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @trace(ptr nocapture noundef readonly %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp.not8 = icmp slt i32 %n, 1
br i1 %cmp.not8, label %for.end, label %if.end.peel
if.end.peel: ; preds = %entry
%0 = add nuw i32 %n, 1
%wide.trip.count = zext i32 %0 to i64
%arrayidx.peel.phi.trans.insert = getelementptr inbounds i32, ptr %A, i64 1
%.pre = load i32, ptr %arrayidx.peel.phi.trans.insert, align 4, !tbaa !5
%call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %0, 2
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 2, %if.end.peel ]
%putchar7 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%0 = tail call ptr @llvm.stacksave.p0()
%vla35 = alloca [1001 x i32], align 16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not52 = icmp slt i32 %1, 1
br i1 %cmp.not52, label %trace.exit, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla35, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body
%cmp.not8.i = icmp slt i32 %2, 1
br i1 %cmp.not8.i, label %trace.exit, label %if.end.peel.i
if.end.peel.i: ; preds = %for.end
%4 = add nuw nsw i32 %2, 1
%wide.trip.count.i = zext i32 %4 to i64
%arrayidx.peel.phi.trans.insert.i = getelementptr inbounds i32, ptr %vla35, i64 1
%.pre.i = load i32, ptr %arrayidx.peel.phi.trans.insert.i, align 4, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %4, 2
br i1 %exitcond.peel.not.i, label %trace.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 2, %if.end.peel.i ]
%putchar7.i = call i32 @putchar(i32 32)
%arrayidx.i = getelementptr inbounds i32, ptr %vla35, i64 %indvars.iv.i
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %trace.exit, label %if.end.i, !llvm.loop !9
trace.exit: ; preds = %if.end.i, %entry, %for.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.not57 = icmp slt i32 %6, 2
br i1 %cmp3.not57, label %for.end20, label %for.body4.lr.ph
for.body4.lr.ph: ; preds = %trace.exit
%arrayidx.peel.phi.trans.insert.i39 = getelementptr inbounds i32, ptr %vla35, i64 1
br label %for.body4
for.body4: ; preds = %for.body4.lr.ph, %trace.exit51
%indvars.iv61 = phi i64 [ 2, %for.body4.lr.ph ], [ %indvars.iv.next62, %trace.exit51 ]
%7 = phi i32 [ %6, %for.body4.lr.ph ], [ %13, %trace.exit51 ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla35, i64 %indvars.iv61
%8 = load i32, ptr %arrayidx6, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body4, %while.body
%indvars.iv63 = phi i64 [ %indvars.iv61, %for.body4 ], [ %indvars.iv.next64, %while.body ]
%indvars.iv.next64 = add nsw i64 %indvars.iv63, -1
%idxprom8 = and i64 %indvars.iv.next64, 4294967295
%arrayidx9 = getelementptr inbounds i32, ptr %vla35, i64 %idxprom8
%9 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %9, %8
br i1 %cmp10, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds i32, ptr %vla35, i64 %indvars.iv63
store i32 %9, ptr %arrayidx14, align 4, !tbaa !5
store i32 %8, ptr %arrayidx9, align 4, !tbaa !5
%10 = icmp sgt i64 %indvars.iv63, 1
br i1 %10, label %land.rhs, label %while.end, !llvm.loop !13
while.end: ; preds = %while.body, %land.rhs
%cmp.not8.i36 = icmp slt i32 %7, 1
br i1 %cmp.not8.i36, label %trace.exit51, label %if.end.peel.i37
if.end.peel.i37: ; preds = %while.end
%11 = add nuw i32 %7, 1
%wide.trip.count.i38 = zext i32 %11 to i64
%.pre.i40 = load i32, ptr %arrayidx.peel.phi.trans.insert.i39, align 4, !tbaa !5
%call2.peel.i41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i40)
%exitcond.peel.not.i42 = icmp eq i32 %11, 2
br i1 %exitcond.peel.not.i42, label %trace.exit51, label %if.end.i43
if.end.i43: ; preds = %if.end.peel.i37, %if.end.i43
%indvars.iv.i44 = phi i64 [ %indvars.iv.next.i48, %if.end.i43 ], [ 2, %if.end.peel.i37 ]
%putchar7.i45 = call i32 @putchar(i32 32)
%arrayidx.i46 = getelementptr inbounds i32, ptr %vla35, i64 %indvars.iv.i44
%12 = load i32, ptr %arrayidx.i46, align 4, !tbaa !5
%call2.i47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
%indvars.iv.next.i48 = add nuw nsw i64 %indvars.iv.i44, 1
%exitcond.not.i49 = icmp eq i64 %indvars.iv.next.i48, %wide.trip.count.i38
br i1 %exitcond.not.i49, label %trace.exit51, label %if.end.i43, !llvm.loop !9
trace.exit51: ; preds = %if.end.i43, %while.end, %if.end.peel.i37
%putchar.i50 = call i32 @putchar(i32 10)
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%13 = load i32, ptr %n, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp3.not.not = icmp slt i64 %indvars.iv61, %14
br i1 %cmp3.not.not, label %for.body4, label %for.end20, !llvm.loop !14
for.end20: ; preds = %trace.exit51, %trace.exit
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
void output(int A[], int N) {
int i;
for (i = 0; i < N; i++) {
if (i > 0) printf(" ");
printf("%d", A[i]);
}
printf("\n");
}
void insertionSort(int A[], int N) {
int i, j;
int tmp;
for (i = 1; i < N; i++) {
tmp = A[i];
j = i - 1;
while (j >= 0 && A[j] >= tmp) {
A[j + 1] = A[j];
j--;
}
A[j + 1] = tmp;
output(A, N);
}
}
int main(void) {
int N;
int A[100];
int i;
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", &A[i]);
}
output(A, N);
insertionSort(A, N);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115390/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115390/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @output(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp8 = icmp sgt i32 %N, 0
br i1 %cmp8, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%.pre = load i32, ptr %A, align 4, !tbaa !5
%call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %N, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar7 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp30 = icmp sgt i32 %N, 1
br i1 %cmp30, label %for.body.us.preheader, label %for.end
for.body.us.preheader: ; preds = %entry
%wide.trip.count.i = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %output.exit.loopexit.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %output.exit.loopexit.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next35 = add nsw i64 %indvars.iv34, -1
%idxprom2.us = and i64 %indvars.iv.next35, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us
%1 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.not.us = icmp slt i32 %1, %0
br i1 %cmp4.not.us, label %while.end.us, label %while.body.us
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv34
store i32 %1, ptr %arrayidx8.us, align 4, !tbaa !5
%2 = icmp sgt i64 %indvars.iv34, 1
br i1 %2, label %land.rhs.us, label %while.end.us, !llvm.loop !12
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv34, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom10.us = ashr exact i64 %sext, 32
%arrayidx11.us = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us
store i32 %0, ptr %arrayidx11.us, align 4, !tbaa !5
%.pre.i.us = load i32, ptr %A, align 4, !tbaa !5
%call2.peel.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us)
br label %if.end.i.us
if.end.i.us: ; preds = %while.end.us, %if.end.i.us
%indvars.iv.i.us = phi i64 [ %indvars.iv.next.i.us, %if.end.i.us ], [ 1, %while.end.us ]
%putchar7.i.us = tail call i32 @putchar(i32 32)
%arrayidx.i.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us
%3 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%call2.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %output.exit.loopexit.us, label %if.end.i.us, !llvm.loop !9
output.exit.loopexit.us: ; preds = %if.end.i.us
%putchar.i.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count.i
br i1 %exitcond.not, label %for.end, label %for.body.us, !llvm.loop !13
for.end: ; preds = %output.exit.loopexit.us, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %0, 0
br i1 %cmp8, label %for.body, label %output.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.body
%cmp8.i = icmp sgt i32 %1, 0
br i1 %cmp8.i, label %if.end.peel.i, label %output.exit
if.end.peel.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %1 to i64
%.pre.i = load i32, ptr %A, align 16, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %1, 1
br i1 %exitcond.peel.not.i, label %output.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar7.i = call i32 @putchar(i32 32)
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %output.exit, label %if.end.i, !llvm.loop !9
output.exit: ; preds = %if.end.i, %entry, %for.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp30.i = icmp sgt i32 %4, 1
br i1 %cmp30.i, label %for.body.us.preheader.i, label %insertionSort.exit
for.body.us.preheader.i: ; preds = %output.exit
%wide.trip.count.i.i = zext i32 %4 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %output.exit.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv.i5 = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i6, %output.exit.loopexit.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i5
%5 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv34.i = phi i64 [ %indvars.iv.next35.i, %while.body.us.i ], [ %indvars.iv.i5, %for.body.us.i ]
%indvars.iv.next35.i = add nsw i64 %indvars.iv34.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next35.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us.i
%6 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.not.us.i = icmp slt i32 %6, %5
br i1 %cmp4.not.us.i, label %while.end.us.i, label %while.body.us.i
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv34.i
store i32 %6, ptr %arrayidx8.us.i, align 4, !tbaa !5
%7 = icmp sgt i64 %indvars.iv34.i, 1
br i1 %7, label %land.rhs.us.i, label %while.end.us.i, !llvm.loop !12
while.end.us.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv34.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom10.us.i = ashr exact i64 %sext.i, 32
%arrayidx11.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us.i
store i32 %5, ptr %arrayidx11.us.i, align 4, !tbaa !5
%.pre.i.us.i = load i32, ptr %A, align 16, !tbaa !5
%call2.peel.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us.i)
br label %if.end.i.us.i
if.end.i.us.i: ; preds = %if.end.i.us.i, %while.end.us.i
%indvars.iv.i.us.i = phi i64 [ %indvars.iv.next.i.us.i, %if.end.i.us.i ], [ 1, %while.end.us.i ]
%putchar7.i.us.i = call i32 @putchar(i32 32)
%arrayidx.i.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us.i
%8 = load i32, ptr %arrayidx.i.us.i, align 4, !tbaa !5
%call2.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%indvars.iv.next.i.us.i = add nuw nsw i64 %indvars.iv.i.us.i, 1
%exitcond.not.i.us.i = icmp eq i64 %indvars.iv.next.i.us.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.us.i, label %output.exit.loopexit.us.i, label %if.end.i.us.i, !llvm.loop !9
output.exit.loopexit.us.i: ; preds = %if.end.i.us.i
%putchar.i.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i6 = add nuw nsw i64 %indvars.iv.i5, 1
%exitcond.not.i7 = icmp eq i64 %indvars.iv.next.i6, %wide.trip.count.i.i
br i1 %exitcond.not.i7, label %insertionSort.exit, label %for.body.us.i, !llvm.loop !13
insertionSort.exit: ; preds = %output.exit.loopexit.us.i, %output.exit
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void show(int n, int *a){
int k;
for (k = 0; k < n - 1; k++){
printf("%d ", a[k]);
}
printf("%d\n", a[n - 1]);
}
int main(void){
int n;
int *a;
int i, j;
int tmp;
scanf("%d", &n);
a = (int *)malloc(sizeof(int) * n);
for (i = 0; i < n; i++){
scanf("%d", &a[i]);
}
for (i = 1; i < n; i++){
tmp = a[i];
j = i - 1;
show(n, a);
while (tmp < a[j] && j >= 0){
a[j + 1] = a[j];
j--;
}
a[j + 1] = tmp;
}
show(n, a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115440/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115440/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @show(i32 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #0 {
entry:
%sub = add i32 %n, -1
%cmp9 = icmp sgt i32 %n, 1
br i1 %cmp9, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %sub to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%idxprom2 = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds i32, ptr %a, i64 %idxprom2
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #5
%cmp61 = icmp sgt i32 %0, 0
br i1 %cmp61, label %for.body, label %for.end25.thread
for.cond4.preheader: ; preds = %for.body
%cmp570 = icmp sgt i32 %1, 1
br i1 %cmp570, label %for.body7.preheader, label %for.end25.thread
for.body7.preheader: ; preds = %for.cond4.preheader
%invariant.gep = getelementptr i32, ptr %call1, i64 -1
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !11
for.body7: ; preds = %for.body7.preheader, %while.end
%indvars.iv79 = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next80, %while.end ]
%indvars.iv75 = phi i64 [ 0, %for.body7.preheader ], [ %indvars.iv.next76, %while.end ]
%3 = phi i32 [ %1, %for.body7.preheader ], [ %.pr, %while.end ]
%arrayidx9 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv79
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%sub.i = add nsw i32 %3, -1
%cmp9.i = icmp sgt i32 %3, 1
br i1 %cmp9.i, label %for.body.preheader.i, label %show.exit
for.body.preheader.i: ; preds = %for.body7
%wide.trip.count.i = zext i32 %sub.i to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %show.exit, label %for.body.i, !llvm.loop !9
show.exit: ; preds = %for.body.i, %for.body7
%idxprom2.i = sext i32 %sub.i to i64
%arrayidx3.i = getelementptr inbounds i32, ptr %call1, i64 %idxprom2.i
%6 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%call4.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv79
%7 = load i32, ptr %gep, align 4, !tbaa !5
%cmp1266 = icmp slt i32 %4, %7
br i1 %cmp1266, label %while.body, label %while.end
while.body: ; preds = %show.exit, %while.body
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %while.body ], [ %indvars.iv79, %show.exit ]
%indvars.iv77 = phi i64 [ %indvars.iv.next78, %while.body ], [ %indvars.iv75, %show.exit ]
%8 = phi i32 [ %9, %while.body ], [ %7, %show.exit ]
%indvars.iv.next82 = add nsw i64 %indvars.iv81, -1
%arrayidx19 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv81
store i32 %8, ptr %arrayidx19, align 4, !tbaa !5
%indvars.iv.next78 = add nsw i64 %indvars.iv77, -1
%arrayidx11 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next78
%9 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp slt i32 %4, %9
%cmp14 = icmp sgt i64 %indvars.iv77, 0
%10 = and i1 %cmp14, %cmp12
br i1 %10, label %while.body, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %show.exit
%j.0.in.lcssa.in = phi i64 [ %indvars.iv79, %show.exit ], [ %indvars.iv77, %while.body ]
%sext = shl i64 %j.0.in.lcssa.in, 32
%idxprom21 = ashr exact i64 %sext, 32
%arrayidx22 = getelementptr inbounds i32, ptr %call1, i64 %idxprom21
store i32 %4, ptr %arrayidx22, align 4, !tbaa !5
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%.pr = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %.pr to i64
%cmp5 = icmp slt i64 %indvars.iv.next80, %11
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
br i1 %cmp5, label %for.body7, label %for.end25, !llvm.loop !13
for.end25.thread: ; preds = %for.cond4.preheader, %entry
%.lcssa.ph = phi i32 [ %1, %for.cond4.preheader ], [ %0, %entry ]
%sub.i4691 = add i32 %.lcssa.ph, -1
br label %show.exit59
for.end25: ; preds = %while.end
%sub.i46 = add i32 %.pr, -1
%cmp9.i47 = icmp sgt i32 %.pr, 1
br i1 %cmp9.i47, label %for.body.preheader.i51, label %show.exit59
for.body.preheader.i51: ; preds = %for.end25
%wide.trip.count.i52 = zext i32 %sub.i46 to i64
br label %for.body.i53
for.body.i53: ; preds = %for.body.i53, %for.body.preheader.i51
%indvars.iv.i54 = phi i64 [ 0, %for.body.preheader.i51 ], [ %indvars.iv.next.i57, %for.body.i53 ]
%arrayidx.i55 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i54
%12 = load i32, ptr %arrayidx.i55, align 4, !tbaa !5
%call.i56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %12)
%indvars.iv.next.i57 = add nuw nsw i64 %indvars.iv.i54, 1
%exitcond.not.i58 = icmp eq i64 %indvars.iv.next.i57, %wide.trip.count.i52
br i1 %exitcond.not.i58, label %show.exit59, label %for.body.i53, !llvm.loop !9
show.exit59: ; preds = %for.body.i53, %for.end25.thread, %for.end25
%sub.i4693 = phi i32 [ %sub.i4691, %for.end25.thread ], [ %sub.i46, %for.end25 ], [ %sub.i46, %for.body.i53 ]
%idxprom2.i48 = sext i32 %sub.i4693 to i64
%arrayidx3.i49 = getelementptr inbounds i32, ptr %call1, i64 %idxprom2.i48
%13 = load i32, ptr %arrayidx3.i49, align 4, !tbaa !5
%call4.i50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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 = { 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 = { nounwind }
attributes #5 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void)
{
int a[1000];
int i, v, j, k, N;
scanf("%d", &N);
for(i = 0; i < N; i++)
scanf("%d", &a[i]);
for(k = 0; k < N; k++) {
if(k > 0)
printf(" ");
printf("%d", a[k]);
}
printf("\n");
for(i = 1; i < N; i++) {
v = a[i];
j = i - 1;
while(j >= 0 && a[j] > v) {
a[j+1] = a[j];
j--;
}
a[j+1] = v;
for(k = 0; k < N; k++) {
if(k > 0)
printf(" ");
printf("%d", a[k]);
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115484/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115484/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [1000 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp69 = icmp sgt i32 %0, 0
br i1 %cmp69, label %for.body, label %for.end12
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %3, 0
br i1 %1, label %if.end.peel, label %for.end12
if.end.peel: ; preds = %for.cond2.preheader
%.pre = load i32, ptr %a, align 16, !tbaa !5
%call9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%2 = load i32, ptr %N, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %2, 1
br i1 %cmp3.peel, label %if.end, label %for.end12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %if.end ], [ 1, %if.end.peel ]
%putchar68 = call i32 @putchar(i32 32)
%arrayidx8 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv81
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%6 = load i32, ptr %N, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next82, %7
br i1 %cmp3, label %if.end, label %for.end12, !llvm.loop !11
for.end12: ; preds = %if.end, %entry, %if.end.peel, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr %N, align 4, !tbaa !5
%cmp1578 = icmp sgt i32 %8, 1
br i1 %cmp1578, label %for.body16, label %for.end46
for.body16: ; preds = %for.end12, %for.end42
%9 = phi i32 [ %17, %for.end42 ], [ %8, %for.end12 ]
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.end42 ], [ 1, %for.end12 ]
%arrayidx18 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv85
%10 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body16, %while.body
%indvars.iv87 = phi i64 [ %indvars.iv85, %for.body16 ], [ %indvars.iv.next88, %while.body ]
%indvars.iv.next88 = add nsw i64 %indvars.iv87, -1
%idxprom20 = and i64 %indvars.iv.next88, 4294967295
%arrayidx21 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %idxprom20
%11 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %11, %10
br i1 %cmp22, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx26 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv87
store i32 %11, ptr %arrayidx26, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv87, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !13
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv87, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom28 = ashr exact i64 %sext, 32
%arrayidx29 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %idxprom28
store i32 %10, ptr %arrayidx29, align 4, !tbaa !5
%cmp3176 = icmp sgt i32 %9, 0
br i1 %cmp3176, label %if.end36.peel, label %for.end42
if.end36.peel: ; preds = %while.end
%.pre97 = load i32, ptr %a, align 16, !tbaa !5
%call39.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre97)
%13 = load i32, ptr %N, align 4, !tbaa !5
%cmp31.peel = icmp sgt i32 %13, 1
br i1 %cmp31.peel, label %if.end36, label %for.end42
if.end36: ; preds = %if.end36.peel, %if.end36
%indvars.iv90 = phi i64 [ %indvars.iv.next91, %if.end36 ], [ 1, %if.end36.peel ]
%putchar67 = call i32 @putchar(i32 32)
%arrayidx38 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv90
%14 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %14)
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%15 = load i32, ptr %N, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp31 = icmp slt i64 %indvars.iv.next91, %16
br i1 %cmp31, label %if.end36, label %for.end42, !llvm.loop !14
for.end42: ; preds = %if.end36, %if.end36.peel, %while.end
%putchar66 = call i32 @putchar(i32 10)
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%17 = load i32, ptr %N, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp15 = icmp slt i64 %indvars.iv.next86, %18
br i1 %cmp15, label %for.body16, label %for.end46, !llvm.loop !15
for.end46: ; preds = %for.end42, %for.end12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
void trace(int A[], int N){
int i ;
for(i=0; i<N;i++){
if(i>0){
printf(" ");
}
printf("%d", A[i]);
}
printf("\n");
}
void intsertionSort(int A[], int N){
int i,j,v;
for(i=1;i<=N-1;i++){
v = A[i];
j = i -1;
while(j>=0 && A[j] > v){
A[j+1] = A[j];
j--;
}
A[j+1] = v;
trace (A, N);
}
}
int main(){
int a,i,num[100];
scanf("%d",&a);
for(i=0;i<a;i++){
scanf("%d",&num[i]);
}
trace(num, a);
intsertionSort(num,a);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115534/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115534/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @trace(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp8 = icmp sgt i32 %N, 0
br i1 %cmp8, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%.pre = load i32, ptr %A, align 4, !tbaa !5
%call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %N, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar7 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @intsertionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp.not.not31 = icmp sgt i32 %N, 1
br i1 %cmp.not.not31, label %for.body.us.preheader, label %for.end
for.body.us.preheader: ; preds = %entry
%wide.trip.count.i = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %trace.exit.loopexit.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %trace.exit.loopexit.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv35 = phi i64 [ %indvars.iv.next36, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next36 = add nsw i64 %indvars.iv35, -1
%idxprom3.us = and i64 %indvars.iv.next36, 4294967295
%arrayidx4.us = getelementptr inbounds i32, ptr %A, i64 %idxprom3.us
%1 = load i32, ptr %arrayidx4.us, align 4, !tbaa !5
%cmp5.us = icmp sgt i32 %1, %0
br i1 %cmp5.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv35, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom11.us = ashr exact i64 %sext, 32
%arrayidx12.us = getelementptr inbounds i32, ptr %A, i64 %idxprom11.us
store i32 %0, ptr %arrayidx12.us, align 4, !tbaa !5
%.pre.i.us = load i32, ptr %A, align 4, !tbaa !5
%call2.peel.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us)
br label %if.end.i.us
if.end.i.us: ; preds = %while.end.us, %if.end.i.us
%indvars.iv.i.us = phi i64 [ %indvars.iv.next.i.us, %if.end.i.us ], [ 1, %while.end.us ]
%putchar7.i.us = tail call i32 @putchar(i32 32)
%arrayidx.i.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us
%2 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%call2.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %trace.exit.loopexit.us, label %if.end.i.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx9.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv35
store i32 %1, ptr %arrayidx9.us, align 4, !tbaa !5
%3 = icmp sgt i64 %indvars.iv35, 1
br i1 %3, label %land.rhs.us, label %while.end.us, !llvm.loop !12
trace.exit.loopexit.us: ; preds = %if.end.i.us
%putchar.i.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count.i
br i1 %exitcond.not, label %for.end, label %for.body.us, !llvm.loop !13
for.end: ; preds = %trace.exit.loopexit.us, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%num = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %num) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %0, 0
br i1 %cmp8, label %for.body, label %trace.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.body
%cmp8.i = icmp sgt i32 %1, 0
br i1 %cmp8.i, label %if.end.peel.i, label %trace.exit
if.end.peel.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %1 to i64
%.pre.i = load i32, ptr %num, align 16, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %1, 1
br i1 %exitcond.peel.not.i, label %trace.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar7.i = call i32 @putchar(i32 32)
%arrayidx.i = getelementptr inbounds i32, ptr %num, i64 %indvars.iv.i
%3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %trace.exit, label %if.end.i, !llvm.loop !9
trace.exit: ; preds = %if.end.i, %entry, %for.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%4 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not.not31.i = icmp sgt i32 %4, 1
br i1 %cmp.not.not31.i, label %for.body.us.preheader.i, label %intsertionSort.exit
for.body.us.preheader.i: ; preds = %trace.exit
%wide.trip.count.i.i = zext i32 %4 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %trace.exit.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv.i5 = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i6, %trace.exit.loopexit.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %num, i64 %indvars.iv.i5
%5 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv35.i = phi i64 [ %indvars.iv.next36.i, %while.body.us.i ], [ %indvars.iv.i5, %for.body.us.i ]
%indvars.iv.next36.i = add nsw i64 %indvars.iv35.i, -1
%idxprom3.us.i = and i64 %indvars.iv.next36.i, 4294967295
%arrayidx4.us.i = getelementptr inbounds i32, ptr %num, i64 %idxprom3.us.i
%6 = load i32, ptr %arrayidx4.us.i, align 4, !tbaa !5
%cmp5.us.i = icmp sgt i32 %6, %5
br i1 %cmp5.us.i, label %while.body.us.i, label %while.end.us.i
while.end.us.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv35.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom11.us.i = ashr exact i64 %sext.i, 32
%arrayidx12.us.i = getelementptr inbounds i32, ptr %num, i64 %idxprom11.us.i
store i32 %5, ptr %arrayidx12.us.i, align 4, !tbaa !5
%.pre.i.us.i = load i32, ptr %num, align 16, !tbaa !5
%call2.peel.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us.i)
br label %if.end.i.us.i
if.end.i.us.i: ; preds = %if.end.i.us.i, %while.end.us.i
%indvars.iv.i.us.i = phi i64 [ %indvars.iv.next.i.us.i, %if.end.i.us.i ], [ 1, %while.end.us.i ]
%putchar7.i.us.i = call i32 @putchar(i32 32)
%arrayidx.i.us.i = getelementptr inbounds i32, ptr %num, i64 %indvars.iv.i.us.i
%7 = load i32, ptr %arrayidx.i.us.i, align 4, !tbaa !5
%call2.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next.i.us.i = add nuw nsw i64 %indvars.iv.i.us.i, 1
%exitcond.not.i.us.i = icmp eq i64 %indvars.iv.next.i.us.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.us.i, label %trace.exit.loopexit.us.i, label %if.end.i.us.i, !llvm.loop !9
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx9.us.i = getelementptr inbounds i32, ptr %num, i64 %indvars.iv35.i
store i32 %6, ptr %arrayidx9.us.i, align 4, !tbaa !5
%8 = icmp sgt i64 %indvars.iv35.i, 1
br i1 %8, label %land.rhs.us.i, label %while.end.us.i, !llvm.loop !12
trace.exit.loopexit.us.i: ; preds = %if.end.i.us.i
%putchar.i.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i6 = add nuw nsw i64 %indvars.iv.i5, 1
%exitcond.not.i7 = icmp eq i64 %indvars.iv.next.i6, %wide.trip.count.i.i
br i1 %exitcond.not.i7, label %intsertionSort.exit, label %for.body.us.i, !llvm.loop !13
intsertionSort.exit: ; preds = %trace.exit.loopexit.us.i, %trace.exit
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %num) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int GetMinIndex(int *a, int start, int len) {
int min = a[start], minIndex = start;
for (int i = start + 1; i < len; i++) {
if (min > a[i]) {
min = a[i];
minIndex = i;
}
}
return minIndex;
}
void Swap(int *a, int *b) {
int tmp = *a;
*a = *b;
*b = tmp;
}
void ReadArray(int *a, int len) {
for (int i = 0; i < len; i++) {
scanf("%d", &a[i]);
}
}
void PrintArray(int *a, int len) {
for (int i = 0; i < len; i++) {
printf("%d%c", a[i], i + 1 == len ? '\n' : ' ');
}
}
void InsertionSort(int *a, int len) {
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A
PrintArray(a, len);
for (int i = 1; i < len; i++) {
int v = a[i];
int j = i - 1;
while (j >= 0 && a[j] > v) {
a[j + 1] = a[j];
j--;
a[j + 1] = v;
}
PrintArray(a, len);
}
}
int main(int argc, char *argv[]) {
int N;
scanf("%d", &N);
int a[N];
ReadArray(a, N);
InsertionSort(a, N);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115578/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115578/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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%c\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @GetMinIndex(ptr nocapture noundef readonly %a, i32 noundef %start, i32 noundef %len) local_unnamed_addr #0 {
entry:
%i.015 = add nsw i32 %start, 1
%cmp16 = icmp slt i32 %i.015, %len
br i1 %cmp16, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%idxprom = sext i32 %start to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%1 = add nsw i64 %idxprom, 1
%2 = xor i32 %start, -1
%3 = add i32 %2, %len
%4 = add i32 %len, -2
%5 = sub i32 %4, %start
%xtraiter = and i32 %3, 3
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %1, %for.body.preheader ]
%minIndex.018.prol = phi i32 [ %spec.select14.prol, %for.body.prol ], [ %start, %for.body.preheader ]
%min.017.prol = phi i32 [ %spec.select.prol, %for.body.prol ], [ %0, %for.body.preheader ]
%prol.iter = phi i32 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader ]
%arrayidx2.prol = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.prol
%6 = load i32, ptr %arrayidx2.prol, align 4, !tbaa !5
%cmp3.prol = icmp sgt i32 %min.017.prol, %6
%spec.select.prol = tail call i32 @llvm.smin.i32(i32 %min.017.prol, i32 %6)
%7 = trunc i64 %indvars.iv.prol to i32
%spec.select14.prol = select i1 %cmp3.prol, i32 %7, i32 %minIndex.018.prol
%indvars.iv.next.prol = add nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i32 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !9
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%spec.select14.lcssa.unr = phi i32 [ undef, %for.body.preheader ], [ %spec.select14.prol, %for.body.prol ]
%indvars.iv.unr = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ]
%minIndex.018.unr = phi i32 [ %start, %for.body.preheader ], [ %spec.select14.prol, %for.body.prol ]
%min.017.unr = phi i32 [ %0, %for.body.preheader ], [ %spec.select.prol, %for.body.prol ]
%8 = icmp ult i32 %5, 3
br i1 %8, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body.prol.loopexit, %for.body, %entry
%minIndex.0.lcssa = phi i32 [ %start, %entry ], [ %spec.select14.lcssa.unr, %for.body.prol.loopexit ], [ %spec.select14.3, %for.body ]
ret i32 %minIndex.0.lcssa
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%minIndex.018 = phi i32 [ %spec.select14.3, %for.body ], [ %minIndex.018.unr, %for.body.prol.loopexit ]
%min.017 = phi i32 [ %spec.select.3, %for.body ], [ %min.017.unr, %for.body.prol.loopexit ]
%arrayidx2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%9 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %min.017, %9
%spec.select = tail call i32 @llvm.smin.i32(i32 %min.017, i32 %9)
%10 = trunc i64 %indvars.iv to i32
%spec.select14 = select i1 %cmp3, i32 %10, i32 %minIndex.018
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx2.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next
%11 = load i32, ptr %arrayidx2.1, align 4, !tbaa !5
%cmp3.1 = icmp sgt i32 %spec.select, %11
%spec.select.1 = tail call i32 @llvm.smin.i32(i32 %spec.select, i32 %11)
%12 = trunc i64 %indvars.iv.next to i32
%spec.select14.1 = select i1 %cmp3.1, i32 %12, i32 %spec.select14
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%arrayidx2.2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.1
%13 = load i32, ptr %arrayidx2.2, align 4, !tbaa !5
%cmp3.2 = icmp sgt i32 %spec.select.1, %13
%spec.select.2 = tail call i32 @llvm.smin.i32(i32 %spec.select.1, i32 %13)
%14 = trunc i64 %indvars.iv.next.1 to i32
%spec.select14.2 = select i1 %cmp3.2, i32 %14, i32 %spec.select14.1
%indvars.iv.next.2 = add nsw i64 %indvars.iv, 3
%arrayidx2.3 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.2
%15 = load i32, ptr %arrayidx2.3, align 4, !tbaa !5
%cmp3.3 = icmp sgt i32 %spec.select.2, %15
%spec.select.3 = tail call i32 @llvm.smin.i32(i32 %spec.select.2, i32 %15)
%16 = trunc i64 %indvars.iv.next.2 to i32
%spec.select14.3 = select i1 %cmp3.3, i32 %16, i32 %spec.select14.2
%indvars.iv.next.3 = add nsw i64 %indvars.iv, 4
%lftr.wideiv.3 = trunc i64 %indvars.iv.next.3 to i32
%exitcond.not.3 = icmp eq i32 %lftr.wideiv.3, %len
br i1 %exitcond.not.3, label %for.cond.cleanup, label %for.body, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @Swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @ReadArray(ptr noundef %a, i32 noundef %len) local_unnamed_addr #3 {
entry:
%cmp3 = icmp sgt i32 %len, 0
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %len to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret void
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !13
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @PrintArray(ptr nocapture noundef readonly %a, i32 noundef %len) local_unnamed_addr #3 {
entry:
%cmp6 = icmp sgt i32 %len, 0
br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = zext i32 %len to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret void
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp1 = icmp eq i64 %indvars.iv.next, %0
%cond = select i1 %cmp1, i32 10, i32 32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1, i32 noundef %cond)
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14
}
; 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 @InsertionSort(ptr nocapture noundef %a, i32 noundef %len) local_unnamed_addr #3 {
entry:
%cmp6.i = icmp sgt i32 %len, 0
br i1 %cmp6.i, label %for.body.preheader.i, label %for.cond.cleanup
for.body.preheader.i: ; preds = %entry
%0 = zext i32 %len to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i
%1 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%cmp1.i = icmp eq i64 %indvars.iv.next.i, %0
%cond.i = select i1 %cmp1.i, i32 10, i32 32
%call.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1, i32 noundef %cond.i)
br i1 %cmp1.i, label %PrintArray.exit, label %for.body.i, !llvm.loop !14
PrintArray.exit: ; preds = %for.body.i
%cmp44 = icmp sgt i32 %len, 1
br i1 %cmp44, label %for.body.us.preheader, label %for.cond.cleanup
for.body.us.preheader: ; preds = %PrintArray.exit
%2 = zext i32 %len to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %PrintArray.exit40.loopexit.us
%indvars.iv52 = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next53, %PrintArray.exit40.loopexit.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %a, i64 %indvars.iv52
%3 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv54 = phi i64 [ %indvars.iv.next55, %while.body.us ], [ %indvars.iv52, %for.body.us ]
%indvars.iv.next55 = add nsw i64 %indvars.iv54, -1
%idxprom2.us = and i64 %indvars.iv.next55, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %a, i64 %idxprom2.us
%4 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp sgt i32 %4, %3
br i1 %cmp4.us, label %while.body.us, label %for.body.i32.us.preheader
for.body.i32.us.preheader: ; preds = %while.body.us, %land.rhs.us
br label %for.body.i32.us
for.body.i32.us: ; preds = %for.body.i32.us.preheader, %for.body.i32.us
%indvars.iv.i33.us = phi i64 [ %indvars.iv.next.i35.us, %for.body.i32.us ], [ 0, %for.body.i32.us.preheader ]
%arrayidx.i34.us = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i33.us
%5 = load i32, ptr %arrayidx.i34.us, align 4, !tbaa !5
%indvars.iv.next.i35.us = add nuw nsw i64 %indvars.iv.i33.us, 1
%cmp1.i36.us = icmp eq i64 %indvars.iv.next.i35.us, %2
%cond.i37.us = select i1 %cmp1.i36.us, i32 10, i32 32
%call.i38.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %cond.i37.us)
br i1 %cmp1.i36.us, label %PrintArray.exit40.loopexit.us, label %for.body.i32.us, !llvm.loop !14
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %a, i64 %indvars.iv54
store i32 %4, ptr %arrayidx8.us, align 4, !tbaa !5
store i32 %3, ptr %arrayidx3.us, align 4, !tbaa !5
%6 = icmp sgt i64 %indvars.iv54, 1
br i1 %6, label %land.rhs.us, label %for.body.i32.us.preheader, !llvm.loop !15
PrintArray.exit40.loopexit.us: ; preds = %for.body.i32.us
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%exitcond62.not = icmp eq i64 %indvars.iv.next53, %2
br i1 %exitcond62.not, label %for.cond.cleanup, label %for.body.us, !llvm.loop !16
for.cond.cleanup: ; preds = %PrintArray.exit40.loopexit.us, %entry, %PrintArray.exit
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #3 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp3.i = icmp sgt i32 %3, 0
br i1 %cmp3.i, label %for.body.preheader.i, label %InsertionSort.exit
for.body.preheader.i: ; preds = %entry
%wide.trip.count.i = zext i32 %3 to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.i)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %ReadArray.exit, label %for.body.i, !llvm.loop !13
ReadArray.exit: ; preds = %for.body.i
%.pr = load i32, ptr %N, align 4, !tbaa !5
%cmp6.i.i = icmp sgt i32 %.pr, 0
br i1 %cmp6.i.i, label %for.body.preheader.i.i, label %InsertionSort.exit
for.body.preheader.i.i: ; preds = %ReadArray.exit
%4 = zext i32 %.pr to i64
br label %for.body.i.i
for.body.i.i: ; preds = %for.body.i.i, %for.body.preheader.i.i
%indvars.iv.i.i = phi i64 [ 0, %for.body.preheader.i.i ], [ %indvars.iv.next.i.i, %for.body.i.i ]
%arrayidx.i.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i.i
%5 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !5
%indvars.iv.next.i.i = add nuw nsw i64 %indvars.iv.i.i, 1
%cmp1.i.i = icmp eq i64 %indvars.iv.next.i.i, %4
%cond.i.i = select i1 %cmp1.i.i, i32 10, i32 32
%call.i.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %cond.i.i)
br i1 %cmp1.i.i, label %PrintArray.exit.i, label %for.body.i.i, !llvm.loop !14
PrintArray.exit.i: ; preds = %for.body.i.i
%cmp44.i = icmp sgt i32 %.pr, 1
br i1 %cmp44.i, label %for.body.us.i, label %InsertionSort.exit
for.body.us.i: ; preds = %PrintArray.exit.i, %PrintArray.exit40.loopexit.us.i
%indvars.iv52.i = phi i64 [ %indvars.iv.next53.i, %PrintArray.exit40.loopexit.us.i ], [ 1, %PrintArray.exit.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv52.i
%6 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv54.i = phi i64 [ %indvars.iv.next55.i, %while.body.us.i ], [ %indvars.iv52.i, %for.body.us.i ]
%indvars.iv.next55.i = add nsw i64 %indvars.iv54.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next55.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr %vla, i64 %idxprom2.us.i
%7 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp sgt i32 %7, %6
br i1 %cmp4.us.i, label %while.body.us.i, label %for.body.i32.us.i.preheader
for.body.i32.us.i.preheader: ; preds = %while.body.us.i, %land.rhs.us.i
br label %for.body.i32.us.i
for.body.i32.us.i: ; preds = %for.body.i32.us.i.preheader, %for.body.i32.us.i
%indvars.iv.i33.us.i = phi i64 [ %indvars.iv.next.i35.us.i, %for.body.i32.us.i ], [ 0, %for.body.i32.us.i.preheader ]
%arrayidx.i34.us.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i33.us.i
%8 = load i32, ptr %arrayidx.i34.us.i, align 4, !tbaa !5
%indvars.iv.next.i35.us.i = add nuw nsw i64 %indvars.iv.i33.us.i, 1
%cmp1.i36.us.i = icmp eq i64 %indvars.iv.next.i35.us.i, %4
%cond.i37.us.i = select i1 %cmp1.i36.us.i, i32 10, i32 32
%call.i38.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8, i32 noundef %cond.i37.us.i)
br i1 %cmp1.i36.us.i, label %PrintArray.exit40.loopexit.us.i, label %for.body.i32.us.i, !llvm.loop !14
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv54.i
store i32 %7, ptr %arrayidx8.us.i, align 4, !tbaa !5
store i32 %6, ptr %arrayidx3.us.i, align 4, !tbaa !5
%9 = icmp sgt i64 %indvars.iv54.i, 1
br i1 %9, label %land.rhs.us.i, label %for.body.i32.us.i.preheader, !llvm.loop !15
PrintArray.exit40.loopexit.us.i: ; preds = %for.body.i32.us.i
%indvars.iv.next53.i = add nuw nsw i64 %indvars.iv52.i, 1
%exitcond62.not.i = icmp eq i64 %indvars.iv.next53.i, %4
br i1 %exitcond62.not.i, label %InsertionSort.exit, label %for.body.us.i, !llvm.loop !16
InsertionSort.exit: ; preds = %PrintArray.exit40.loopexit.us.i, %entry, %ReadArray.exit, %PrintArray.exit.i
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { nofree 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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 nocallback nofree nosync nounwind willreturn }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!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}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
|
#include <stdio.h>
void printl(int *x,int n){
for(int t=0;t<n;t++){
printf("%d",x[t]);
printf(t==n-1?"\n":" ");
}
}
int main(){
int n,i,j,v,a[100];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printl(a,n);
for(i=1;i<n;i++){
v=a[i];
j=i-1;
while(j>=0&&a[j]>v){
a[j+1]=a[j];
j--;
}
a[j+1]=v;
printl(a,n);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115628/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115628/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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"\0A\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c" \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @printl(ptr nocapture noundef readonly %x, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %entry
%sub = add nsw i32 %n, -1
%0 = zext i32 %sub to i64
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret void
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %x, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%cmp1 = icmp eq i64 %indvars.iv, %0
%cond = select i1 %cmp1, ptr @.str.1, ptr @.str.2
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp49 = icmp sgt i32 %0, 0
br i1 %cmp49, label %for.body, label %for.end21
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body
%cmp7.i = icmp sgt i32 %1, 0
br i1 %cmp7.i, label %for.body.lr.ph.i, label %for.end21
for.body.lr.ph.i: ; preds = %for.end
%sub.i = add nsw i32 %1, -1
%3 = zext i32 %sub.i to i64
%wide.trip.count.i = zext i32 %1 to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.lr.ph.i
%indvars.iv.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next.i, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i
%4 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%cmp1.i = icmp eq i64 %indvars.iv.i, %3
%cond.i = select i1 %cmp1.i, ptr @.str.1, ptr @.str.2
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond.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
br i1 %exitcond.not.i, label %printl.exit, label %for.body.i, !llvm.loop !9
printl.exit: ; preds = %for.body.i
%.pre = load i32, ptr %n, align 4, !tbaa !5
%cmp354 = icmp sgt i32 %.pre, 1
br i1 %cmp354, label %for.body4, label %for.end21
for.body4: ; preds = %printl.exit, %printl.exit48
%5 = phi i32 [ %11, %printl.exit48 ], [ %.pre, %printl.exit ]
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %printl.exit48 ], [ 1, %printl.exit ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv58
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body4, %while.body
%indvars.iv60 = phi i64 [ %indvars.iv58, %for.body4 ], [ %indvars.iv.next61, %while.body ]
%indvars.iv.next61 = add nsw i64 %indvars.iv60, -1
%idxprom8 = and i64 %indvars.iv.next61, 4294967295
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom8
%7 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %7, %6
br i1 %cmp10, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv60
store i32 %7, ptr %arrayidx14, align 4, !tbaa !5
%8 = icmp sgt i64 %indvars.iv60, 1
br i1 %8, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv60, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom16 = ashr exact i64 %sext, 32
%arrayidx17 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom16
store i32 %6, ptr %arrayidx17, align 4, !tbaa !5
%cmp7.i35 = icmp sgt i32 %5, 0
br i1 %cmp7.i35, label %for.body.lr.ph.i36, label %printl.exit48
for.body.lr.ph.i36: ; preds = %while.end
%sub.i37 = add nsw i32 %5, -1
%9 = zext i32 %sub.i37 to i64
%wide.trip.count.i38 = zext i32 %5 to i64
br label %for.body.i39
for.body.i39: ; preds = %for.body.i39, %for.body.lr.ph.i36
%indvars.iv.i40 = phi i64 [ 0, %for.body.lr.ph.i36 ], [ %indvars.iv.next.i46, %for.body.i39 ]
%arrayidx.i41 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i40
%10 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%call.i42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10)
%cmp1.i43 = icmp eq i64 %indvars.iv.i40, %9
%cond.i44 = select i1 %cmp1.i43, ptr @.str.1, ptr @.str.2
%call2.i45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond.i44)
%indvars.iv.next.i46 = add nuw nsw i64 %indvars.iv.i40, 1
%exitcond.not.i47 = icmp eq i64 %indvars.iv.next.i46, %wide.trip.count.i38
br i1 %exitcond.not.i47, label %printl.exit48.loopexit, label %for.body.i39, !llvm.loop !9
printl.exit48.loopexit: ; preds = %for.body.i39
%.pre65 = load i32, ptr %n, align 4, !tbaa !5
br label %printl.exit48
printl.exit48: ; preds = %printl.exit48.loopexit, %while.end
%11 = phi i32 [ %.pre65, %printl.exit48.loopexit ], [ %5, %while.end ]
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%12 = sext i32 %11 to i64
%cmp3 = icmp slt i64 %indvars.iv.next59, %12
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !13
for.end21: ; preds = %printl.exit48, %entry, %for.end, %printl.exit
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main()
{
int m;
while(scanf("%d",&m)!=EOF){
int key,i,j,x,A[150];
for(i=0;i<m;i++)scanf("%d",&A[i]);
for(i=0;i<m;i++){
key=A[i];
j=i-1;
while(j>=0&&A[j]>key){
A[j+1]=A[j];
j--;
A[j+1]=key;
}
for(x=0; x<m-1; x++)printf("%d ",A[x]);printf("%d\n",A[x]);
}
}return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115671/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115671/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%A = alloca [150 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
%call65 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%cmp.not66 = icmp eq i32 %call65, -1
br i1 %cmp.not66, label %while.end37, label %while.body
while.body: ; preds = %entry, %for.end36
call void @llvm.lifetime.start.p0(i64 600, ptr nonnull %A) #3
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp154 = icmp sgt i32 %0, 0
br i1 %cmp154, label %for.body, label %for.end36
for.cond3.preheader: ; preds = %for.body
%cmp463 = icmp sgt i32 %1, 0
br i1 %cmp463, label %for.body5, label %for.end36
for.body: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.body ]
%arrayidx = getelementptr inbounds [150 x i32], ptr %A, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %m, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp1, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.body5: ; preds = %for.cond3.preheader, %for.end30
%3 = phi i32 [ %11, %for.end30 ], [ %1, %for.cond3.preheader ]
%indvars.iv68 = phi i64 [ %indvars.iv.next69, %for.end30 ], [ 0, %for.cond3.preheader ]
%arrayidx7 = getelementptr inbounds [150 x i32], ptr %A, i64 0, i64 %indvars.iv68
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp957.not = icmp eq i64 %indvars.iv68, 0
br i1 %cmp957.not, label %while.end, label %land.rhs
land.rhs: ; preds = %for.body5, %while.body13
%indvars.iv70 = phi i64 [ %indvars.iv.next71, %while.body13 ], [ %indvars.iv68, %for.body5 ]
%indvars.iv.next71 = add nsw i64 %indvars.iv70, -1
%idxprom10 = and i64 %indvars.iv.next71, 4294967295
%arrayidx11 = getelementptr inbounds [150 x i32], ptr %A, i64 0, i64 %idxprom10
%5 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %5, %4
br i1 %cmp12, label %while.body13, label %while.end
while.body13: ; preds = %land.rhs
%arrayidx17 = getelementptr inbounds [150 x i32], ptr %A, i64 0, i64 %indvars.iv70
store i32 %5, ptr %arrayidx17, align 4, !tbaa !5
store i32 %4, ptr %arrayidx11, align 4, !tbaa !5
%6 = icmp sgt i64 %indvars.iv70, 1
br i1 %6, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %land.rhs, %while.body13, %for.body5
%cmp2361 = icmp sgt i32 %3, 1
br i1 %cmp2361, label %for.body24, label %for.end30
for.body24: ; preds = %while.end, %for.body24
%indvars.iv73 = phi i64 [ %indvars.iv.next74, %for.body24 ], [ 0, %while.end ]
%arrayidx26 = getelementptr inbounds [150 x i32], ptr %A, i64 0, i64 %indvars.iv73
%7 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
%8 = load i32, ptr %m, align 4, !tbaa !5
%sub22 = add nsw i32 %8, -1
%9 = sext i32 %sub22 to i64
%cmp23 = icmp slt i64 %indvars.iv.next74, %9
br i1 %cmp23, label %for.body24, label %for.end30, !llvm.loop !12
for.end30: ; preds = %for.body24, %while.end
%x.0.lcssa = phi i64 [ 0, %while.end ], [ %indvars.iv.next74, %for.body24 ]
%idxprom31 = and i64 %x.0.lcssa, 4294967295
%arrayidx32 = getelementptr inbounds [150 x i32], ptr %A, i64 0, i64 %idxprom31
%10 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%11 = load i32, ptr %m, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp4 = icmp slt i64 %indvars.iv.next69, %12
br i1 %cmp4, label %for.body5, label %for.end36, !llvm.loop !13
for.end36: ; preds = %for.end30, %while.body, %for.cond3.preheader
call void @llvm.lifetime.end.p0(i64 600, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end37, label %while.body, !llvm.loop !14
while.end37: ; preds = %for.end36, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
void trace(int A[],int N) {
int i;
for(i=0;i<N;i++) {
if(i>0) printf(" ");
printf("%d",A[i]);
}
printf("\n");
}
void insertionSort(int A[], int N) {
int i,j,v;
for(i=1;i<N;i++) {
v=A[i];
j=i-1;
while(j>=0 && A[j] > v) {
A[j+1] = A[j];
j--;
}
A[j+1]=v;
trace(A,N);
}
}
int main(void)
{
int N, i, j;
int A[100];
scanf("%d",&N);
for(i=0;i<N;i++) scanf("%d",&A[i]);
trace(A,N);
insertionSort(A,N);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115714/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115714/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @trace(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp8 = icmp sgt i32 %N, 0
br i1 %cmp8, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%.pre = load i32, ptr %A, align 4, !tbaa !5
%call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %N, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar7 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp30 = icmp sgt i32 %N, 1
br i1 %cmp30, label %for.body.us.preheader, label %for.end
for.body.us.preheader: ; preds = %entry
%wide.trip.count.i = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %trace.exit.loopexit.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %trace.exit.loopexit.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next35 = add nsw i64 %indvars.iv34, -1
%idxprom2.us = and i64 %indvars.iv.next35, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us
%1 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp sgt i32 %1, %0
br i1 %cmp4.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv34, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom10.us = ashr exact i64 %sext, 32
%arrayidx11.us = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us
store i32 %0, ptr %arrayidx11.us, align 4, !tbaa !5
%.pre.i.us = load i32, ptr %A, align 4, !tbaa !5
%call2.peel.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us)
br label %if.end.i.us
if.end.i.us: ; preds = %while.end.us, %if.end.i.us
%indvars.iv.i.us = phi i64 [ %indvars.iv.next.i.us, %if.end.i.us ], [ 1, %while.end.us ]
%putchar7.i.us = tail call i32 @putchar(i32 32)
%arrayidx.i.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us
%2 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%call2.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %trace.exit.loopexit.us, label %if.end.i.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv34
store i32 %1, ptr %arrayidx8.us, align 4, !tbaa !5
%3 = icmp sgt i64 %indvars.iv34, 1
br i1 %3, label %land.rhs.us, label %while.end.us, !llvm.loop !12
trace.exit.loopexit.us: ; preds = %if.end.i.us
%putchar.i.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count.i
br i1 %exitcond.not, label %for.end, label %for.body.us, !llvm.loop !13
for.end: ; preds = %trace.exit.loopexit.us, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %0, 0
br i1 %cmp8, label %for.body, label %trace.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.body
%cmp8.i = icmp sgt i32 %1, 0
br i1 %cmp8.i, label %if.end.peel.i, label %trace.exit
if.end.peel.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %1 to i64
%.pre.i = load i32, ptr %A, align 16, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %1, 1
br i1 %exitcond.peel.not.i, label %trace.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar7.i = call i32 @putchar(i32 32)
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %trace.exit, label %if.end.i, !llvm.loop !9
trace.exit: ; preds = %if.end.i, %entry, %for.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp30.i = icmp sgt i32 %4, 1
br i1 %cmp30.i, label %for.body.us.preheader.i, label %insertionSort.exit
for.body.us.preheader.i: ; preds = %trace.exit
%wide.trip.count.i.i = zext i32 %4 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %trace.exit.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv.i5 = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i6, %trace.exit.loopexit.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i5
%5 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv34.i = phi i64 [ %indvars.iv.next35.i, %while.body.us.i ], [ %indvars.iv.i5, %for.body.us.i ]
%indvars.iv.next35.i = add nsw i64 %indvars.iv34.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next35.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us.i
%6 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp sgt i32 %6, %5
br i1 %cmp4.us.i, label %while.body.us.i, label %while.end.us.i
while.end.us.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv34.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom10.us.i = ashr exact i64 %sext.i, 32
%arrayidx11.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us.i
store i32 %5, ptr %arrayidx11.us.i, align 4, !tbaa !5
%.pre.i.us.i = load i32, ptr %A, align 16, !tbaa !5
%call2.peel.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us.i)
br label %if.end.i.us.i
if.end.i.us.i: ; preds = %if.end.i.us.i, %while.end.us.i
%indvars.iv.i.us.i = phi i64 [ %indvars.iv.next.i.us.i, %if.end.i.us.i ], [ 1, %while.end.us.i ]
%putchar7.i.us.i = call i32 @putchar(i32 32)
%arrayidx.i.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us.i
%7 = load i32, ptr %arrayidx.i.us.i, align 4, !tbaa !5
%call2.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next.i.us.i = add nuw nsw i64 %indvars.iv.i.us.i, 1
%exitcond.not.i.us.i = icmp eq i64 %indvars.iv.next.i.us.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.us.i, label %trace.exit.loopexit.us.i, label %if.end.i.us.i, !llvm.loop !9
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv34.i
store i32 %6, ptr %arrayidx8.us.i, align 4, !tbaa !5
%8 = icmp sgt i64 %indvars.iv34.i, 1
br i1 %8, label %land.rhs.us.i, label %while.end.us.i, !llvm.loop !12
trace.exit.loopexit.us.i: ; preds = %if.end.i.us.i
%putchar.i.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i6 = add nuw nsw i64 %indvars.iv.i5, 1
%exitcond.not.i7 = icmp eq i64 %indvars.iv.next.i6, %wide.trip.count.i.i
br i1 %exitcond.not.i7, label %insertionSort.exit, label %for.body.us.i, !llvm.loop !13
insertionSort.exit: ; preds = %trace.exit.loopexit.us.i, %trace.exit
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
/*
* File: main.c
* Author: s1252007
*
* Created on June 15, 2018, 10:57 AM
*/
#include <stdio.h>
#include <stdlib.h>
void insertionSort(
int *A,
int N
);
/*
*
*/
int main(int argc, char** argv) {
int size;
int *A;
scanf("%d", &size);
A = (int *)malloc(sizeof(int) * size);
if (A == NULL) return EXIT_FAILURE;
for (int ix = 0; ix < size; ++ix)
{
scanf("%d", &A[ix]);
if (ix > 0) printf(" ");
printf("%d", A[ix]);
}
printf("\n");
insertionSort(A, size);
return (EXIT_SUCCESS);
}
void insertionSort(int *A, int N) // N個の要素を含む0-オリジンの配列A
{
int v, j;
for (int i = 1; i <= N-1; ++i)
{
v = A[i];
j = i - 1;
while (j >= 0 && A[j] > v)
{
A[j+1] = A[j];
j--;
}
A[j+1] = v;
for (int p = 0; p < N; ++p)
{
if (p > 0) printf(" ");
printf("%d", A[p]);
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115758/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115758/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%size = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %size) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %size)
%0 = load i32, ptr %size, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
%cmp = icmp eq ptr %call1, null
br i1 %cmp, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp324 = icmp sgt i32 %0, 0
br i1 %cmp324, label %if.end10.peel, label %for.cond.cleanup
if.end10.peel: ; preds = %for.cond.preheader
%call5.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %call1)
%.pre = load i32, ptr %call1, align 4, !tbaa !5
%call13.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%1 = load i32, ptr %size, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %1, 1
br i1 %cmp3.peel, label %if.end10, label %for.cond.cleanup
for.cond.cleanup: ; preds = %if.end10, %if.end10.peel, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%2 = load i32, ptr %size, align 4, !tbaa !5
%cmp.not.not49.i = icmp sgt i32 %2, 1
br i1 %cmp.not.not49.i, label %for.body.us.preheader.i, label %cleanup
for.body.us.preheader.i: ; preds = %for.cond.cleanup
%wide.trip.count62.i = zext i32 %2 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond13.for.cond.cleanup15_crit_edge.us.i, %for.body.us.preheader.i
%indvars.iv.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i, %for.cond13.for.cond.cleanup15_crit_edge.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i
%3 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv52.i = phi i64 [ %indvars.iv.next53.i, %while.body.us.i ], [ %indvars.iv.i, %for.body.us.i ]
%indvars.iv.next53.i = add nsw i64 %indvars.iv52.i, -1
%idxprom3.us.i = and i64 %indvars.iv.next53.i, 4294967295
%arrayidx4.us.i = getelementptr inbounds i32, ptr %call1, i64 %idxprom3.us.i
%4 = load i32, ptr %arrayidx4.us.i, align 4, !tbaa !5
%cmp5.us.i = icmp sgt i32 %4, %3
br i1 %cmp5.us.i, label %while.body.us.i, label %if.end.us.peel.i
if.end.us.peel.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv52.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom11.us.i = ashr exact i64 %sext.i, 32
%arrayidx12.us.i = getelementptr inbounds i32, ptr %call1, i64 %idxprom11.us.i
store i32 %3, ptr %arrayidx12.us.i, align 4, !tbaa !5
%.pre.i = load i32, ptr %call1, align 4, !tbaa !5
%call20.us.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre.i)
br label %if.end.us.i
if.end.us.i: ; preds = %if.end.us.i, %if.end.us.peel.i
%indvars.iv55.i = phi i64 [ %indvars.iv.next56.i, %if.end.us.i ], [ 1, %if.end.us.peel.i ]
%putchar43.us.i = call i32 @putchar(i32 32)
%arrayidx19.us.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv55.i
%5 = load i32, ptr %arrayidx19.us.i, align 4, !tbaa !5
%call20.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next56.i = add nuw nsw i64 %indvars.iv55.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next56.i, %wide.trip.count62.i
br i1 %exitcond.not.i, label %for.cond13.for.cond.cleanup15_crit_edge.us.i, label %if.end.us.i, !llvm.loop !9
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx9.us.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv52.i
store i32 %4, ptr %arrayidx9.us.i, align 4, !tbaa !5
%6 = icmp sgt i64 %indvars.iv52.i, 1
br i1 %6, label %land.rhs.us.i, label %if.end.us.peel.i, !llvm.loop !12
for.cond13.for.cond.cleanup15_crit_edge.us.i: ; preds = %if.end.us.i
%putchar.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond63.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count62.i
br i1 %exitcond63.not.i, label %cleanup, label %for.body.us.i, !llvm.loop !13
if.end10: ; preds = %if.end10.peel, %if.end10
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end10 ], [ 1, %if.end10.peel ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%putchar23 = call i32 @putchar(i32 32)
%7 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %size, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp3, label %if.end10, label %for.cond.cleanup, !llvm.loop !14
cleanup: ; preds = %for.cond13.for.cond.cleanup15_crit_edge.us.i, %for.cond.cleanup, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %for.cond.cleanup ], [ 0, %for.cond13.for.cond.cleanup15_crit_edge.us.i ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %size) #5
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: 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: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp.not.not49 = icmp sgt i32 %N, 1
br i1 %cmp.not.not49, label %for.body.us.preheader, label %for.cond.cleanup
for.body.us.preheader: ; preds = %entry
%wide.trip.count62 = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond13.for.cond.cleanup15_crit_edge.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %for.cond13.for.cond.cleanup15_crit_edge.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv52 = phi i64 [ %indvars.iv.next53, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next53 = add nsw i64 %indvars.iv52, -1
%idxprom3.us = and i64 %indvars.iv.next53, 4294967295
%arrayidx4.us = getelementptr inbounds i32, ptr %A, i64 %idxprom3.us
%1 = load i32, ptr %arrayidx4.us, align 4, !tbaa !5
%cmp5.us = icmp sgt i32 %1, %0
br i1 %cmp5.us, label %while.body.us, label %if.end.us.peel
if.end.us.peel: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv52, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom11.us = ashr exact i64 %sext, 32
%arrayidx12.us = getelementptr inbounds i32, ptr %A, i64 %idxprom11.us
store i32 %0, ptr %arrayidx12.us, align 4, !tbaa !5
%.pre = load i32, ptr %A, align 4, !tbaa !5
%call20.us.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
br label %if.end.us
if.end.us: ; preds = %if.end.us.peel, %if.end.us
%indvars.iv55 = phi i64 [ %indvars.iv.next56, %if.end.us ], [ 1, %if.end.us.peel ]
%putchar43.us = tail call i32 @putchar(i32 32)
%arrayidx19.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv55
%2 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
%call20.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
%indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
%exitcond.not = icmp eq i64 %indvars.iv.next56, %wide.trip.count62
br i1 %exitcond.not, label %for.cond13.for.cond.cleanup15_crit_edge.us, label %if.end.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx9.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv52
store i32 %1, ptr %arrayidx9.us, align 4, !tbaa !5
%3 = icmp sgt i64 %indvars.iv52, 1
br i1 %3, label %land.rhs.us, label %if.end.us.peel, !llvm.loop !12
for.cond13.for.cond.cleanup15_crit_edge.us: ; preds = %if.end.us
%putchar.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond63.not = icmp eq i64 %indvars.iv.next, %wide.trip.count62
br i1 %exitcond63.not, label %for.cond.cleanup, label %for.body.us, !llvm.loop !13
for.cond.cleanup: ; preds = %for.cond13.for.cond.cleanup15_crit_edge.us, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !11}
|
#include<stdio.h>
int main(){
int n,a[1000];
int i,j,k;
int v;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=1;i<n;i++){
v=a[i];
j=i-1;
for(k=0;k<n;k++){
printf("%d",a[k]);
if(k!=n-1)
printf(" ");
}
printf("\n");
while(j>=0 && a[j]>v){
a[j+1] = a[j];
j--;
}
a[j+1] = v;
}
for(k=0;k<n;k++){
printf("%d",a[k]);
if(k!=n-1)
printf(" ");
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115800/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115800/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp71 = icmp sgt i32 %0, 0
br i1 %cmp71, label %for.body, label %for.end47
for.cond2.preheader: ; preds = %for.body
%cmp378 = icmp sgt i32 %1, 1
br i1 %cmp378, label %for.body4, label %for.cond34.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond34.preheader: ; preds = %while.end, %for.cond2.preheader
%3 = phi i32 [ %1, %for.cond2.preheader ], [ %13, %while.end ]
%cmp3580 = icmp sgt i32 %3, 0
br i1 %cmp3580, label %for.body36, label %for.end47
for.body4: ; preds = %for.cond2.preheader, %while.end
%4 = phi i32 [ %13, %while.end ], [ %1, %for.cond2.preheader ]
%indvars.iv86 = phi i64 [ %indvars.iv.next87, %while.end ], [ 1, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv86
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp873 = icmp sgt i32 %4, 0
br i1 %cmp873, label %for.body9, label %for.end18
for.body9: ; preds = %for.body4, %for.inc16
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.inc16 ], [ 0, %for.body4 ]
%arrayidx11 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv83
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%7 = load i32, ptr %n, align 4, !tbaa !5
%sub13 = add nsw i32 %7, -1
%8 = zext i32 %sub13 to i64
%cmp14.not = icmp eq i64 %indvars.iv83, %8
br i1 %cmp14.not, label %for.inc16, label %if.then
if.then: ; preds = %for.body9
%putchar70 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc16
for.inc16: ; preds = %for.body9, %if.then
%9 = phi i32 [ %7, %for.body9 ], [ %.pre, %if.then ]
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%10 = sext i32 %9 to i64
%cmp8 = icmp slt i64 %indvars.iv.next84, %10
br i1 %cmp8, label %for.body9, label %for.end18, !llvm.loop !11
for.end18: ; preds = %for.inc16, %for.body4
%putchar69 = call i32 @putchar(i32 10)
br label %land.rhs
land.rhs: ; preds = %for.end18, %while.body
%indvars.iv88 = phi i64 [ %indvars.iv86, %for.end18 ], [ %indvars.iv.next89, %while.body ]
%indvars.iv.next89 = add nsw i64 %indvars.iv88, -1
%idxprom21 = and i64 %indvars.iv.next89, 4294967295
%arrayidx22 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %idxprom21
%11 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %11, %5
br i1 %cmp23, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx27 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv88
store i32 %11, ptr %arrayidx27, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv88, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv88, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom29 = ashr exact i64 %sext, 32
%arrayidx30 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %idxprom29
store i32 %5, ptr %arrayidx30, align 4, !tbaa !5
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%13 = load i32, ptr %n, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp3 = icmp slt i64 %indvars.iv.next87, %14
br i1 %cmp3, label %for.body4, label %for.cond34.preheader, !llvm.loop !13
for.body36: ; preds = %for.cond34.preheader, %for.inc45
%indvars.iv93 = phi i64 [ %indvars.iv.next94, %for.inc45 ], [ 0, %for.cond34.preheader ]
%arrayidx38 = getelementptr inbounds [1000 x i32], ptr %a, i64 0, i64 %indvars.iv93
%15 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %15)
%16 = load i32, ptr %n, align 4, !tbaa !5
%sub40 = add nsw i32 %16, -1
%17 = zext i32 %sub40 to i64
%cmp41.not = icmp eq i64 %indvars.iv93, %17
br i1 %cmp41.not, label %for.inc45, label %if.then42
if.then42: ; preds = %for.body36
%putchar68 = call i32 @putchar(i32 32)
%.pre97 = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc45
for.inc45: ; preds = %for.body36, %if.then42
%18 = phi i32 [ %16, %for.body36 ], [ %.pre97, %if.then42 ]
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%19 = sext i32 %18 to i64
%cmp35 = icmp slt i64 %indvars.iv.next94, %19
br i1 %cmp35, label %for.body36, label %for.end47, !llvm.loop !14
for.end47: ; preds = %for.inc45, %entry, %for.cond34.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
void t(int A[],int n){
int i;
for(i=0;i<n;i++){
if(i>0)printf(" ");
printf("%d",A[i]);
}
printf("\n");
}
int main(){
int i,j,n,key,k,A[100];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
t(A,n);
for(i=1;i<n;i++){
key=A[i];
j=i-1;
while(j>=0 && A[j]>key){
A[j+1]=A[j];
j--;
}
A[j+1]=key;
t(A,n);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115844/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115844/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @t(ptr nocapture noundef readonly %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp8 = icmp sgt i32 %n, 0
br i1 %cmp8, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%.pre = load i32, ptr %A, align 4, !tbaa !5
%call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %n, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar7 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%A = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp50 = icmp sgt i32 %0, 0
br i1 %cmp50, label %for.body, label %t.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body
%cmp8.i = icmp sgt i32 %1, 0
br i1 %cmp8.i, label %if.end.peel.i, label %t.exit
if.end.peel.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %1 to i64
%.pre.i = load i32, ptr %A, align 16, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %1, 1
br i1 %exitcond.peel.not.i, label %t.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar7.i = call i32 @putchar(i32 32)
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %t.exit, label %if.end.i, !llvm.loop !9
t.exit: ; preds = %if.end.i, %entry, %for.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp355 = icmp sgt i32 %4, 1
br i1 %cmp355, label %for.body4, label %for.end21
for.body4: ; preds = %t.exit, %t.exit49
%indvars.iv59 = phi i64 [ %indvars.iv.next60, %t.exit49 ], [ 1, %t.exit ]
%5 = phi i32 [ %10, %t.exit49 ], [ %4, %t.exit ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv59
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body4, %while.body
%indvars.iv61 = phi i64 [ %indvars.iv59, %for.body4 ], [ %indvars.iv.next62, %while.body ]
%indvars.iv.next62 = add nsw i64 %indvars.iv61, -1
%idxprom8 = and i64 %indvars.iv.next62, 4294967295
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom8
%7 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %7, %6
br i1 %cmp10, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv61
store i32 %7, ptr %arrayidx14, align 4, !tbaa !5
%8 = icmp sgt i64 %indvars.iv61, 1
br i1 %8, label %land.rhs, label %while.end, !llvm.loop !13
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv61, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom16 = ashr exact i64 %sext, 32
%arrayidx17 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom16
store i32 %6, ptr %arrayidx17, align 4, !tbaa !5
%cmp8.i35 = icmp sgt i32 %5, 0
br i1 %cmp8.i35, label %if.end.peel.i37, label %t.exit49
if.end.peel.i37: ; preds = %while.end
%wide.trip.count.i38 = zext i32 %5 to i64
%.pre.i39 = load i32, ptr %A, align 16, !tbaa !5
%call2.peel.i40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i39)
%exitcond.peel.not.i41 = icmp eq i32 %5, 1
br i1 %exitcond.peel.not.i41, label %t.exit49, label %if.end.i42
if.end.i42: ; preds = %if.end.peel.i37, %if.end.i42
%indvars.iv.i43 = phi i64 [ %indvars.iv.next.i47, %if.end.i42 ], [ 1, %if.end.peel.i37 ]
%putchar7.i44 = call i32 @putchar(i32 32)
%arrayidx.i45 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i43
%9 = load i32, ptr %arrayidx.i45, align 4, !tbaa !5
%call2.i46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
%indvars.iv.next.i47 = add nuw nsw i64 %indvars.iv.i43, 1
%exitcond.not.i48 = icmp eq i64 %indvars.iv.next.i47, %wide.trip.count.i38
br i1 %exitcond.not.i48, label %t.exit49, label %if.end.i42, !llvm.loop !9
t.exit49: ; preds = %if.end.i42, %while.end, %if.end.peel.i37
%putchar.i36 = call i32 @putchar(i32 10)
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp3 = icmp slt i64 %indvars.iv.next60, %11
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %t.exit49, %t.exit
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#include<stdlib.h>
int main(void){
int i, N, V, j, k;
int *In;
scanf("%d",&N);
In = (int*)malloc(sizeof(int)*N);
for(k=0 ; k<N ; k++){
scanf("%d",&In[k]);
}
printf("%d",In[0]);
for(k=1 ; k<N ; k++){
printf(" %d",In[k]);
}
printf("\n");
for(i=1 ; i<N ; i++){
V=In[i];
j=i-1;
while(j>=0 && In[j]>V){
In[j+1] = In[j];
j--;
In[j+1]=V;
}
printf("%d",In[0]);
for(k=1 ; k<N ; k++){
printf(" %d",In[k]);
}
printf("\n");
}
free(In);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115888/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115888/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%conv = zext i32 %0 to i64
%mul = shl nuw nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #8
%cmp81 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp81)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%.pre = load i32, ptr %call1, align 4, !tbaa !5
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp783 = icmp sgt i32 %3, 1
br i1 %cmp783, label %for.body9, label %for.end15
for.body9: ; preds = %for.end.loopexit, %for.body9
%indvars.iv93 = phi i64 [ %indvars.iv.next94, %for.body9 ], [ 1, %for.end.loopexit ]
%arrayidx11 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv93
%4 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp7 = icmp slt i64 %indvars.iv.next94, %6
br i1 %cmp7, label %for.body9, label %for.end15, !llvm.loop !11
for.end15: ; preds = %for.body9, %for.end.loopexit
%putchar = call i32 @putchar(i32 10)
%7 = load i32, ptr %N, align 4, !tbaa !5
%cmp1890 = icmp sgt i32 %7, 1
br i1 %cmp1890, label %for.body20, label %for.end51
for.body20: ; preds = %for.end15, %for.end47
%indvars.iv96 = phi i64 [ %indvars.iv.next97, %for.end47 ], [ 1, %for.end15 ]
%arrayidx22 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv96
%8 = load i32, ptr %arrayidx22, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body20, %while.body
%indvars.iv98 = phi i64 [ %indvars.iv96, %for.body20 ], [ %indvars.iv.next99, %while.body ]
%indvars.iv.next99 = add nsw i64 %indvars.iv98, -1
%idxprom25 = and i64 %indvars.iv.next99, 4294967295
%arrayidx26 = getelementptr inbounds i32, ptr %call1, i64 %idxprom25
%9 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %9, %8
br i1 %cmp27, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx32 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv98
store i32 %9, ptr %arrayidx32, align 4, !tbaa !5
store i32 %8, ptr %arrayidx26, align 4, !tbaa !5
%10 = icmp sgt i64 %indvars.iv98, 1
br i1 %10, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%11 = load i32, ptr %call1, align 4, !tbaa !5
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11)
%12 = load i32, ptr %N, align 4, !tbaa !5
%cmp3988 = icmp sgt i32 %12, 1
br i1 %cmp3988, label %for.body41, label %for.end47
for.body41: ; preds = %while.end, %for.body41
%indvars.iv101 = phi i64 [ %indvars.iv.next102, %for.body41 ], [ 1, %while.end ]
%arrayidx43 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv101
%13 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
%indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
%14 = load i32, ptr %N, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp39 = icmp slt i64 %indvars.iv.next102, %15
br i1 %cmp39, label %for.body41, label %for.end47, !llvm.loop !13
for.end47: ; preds = %for.body41, %while.end
%putchar80 = call i32 @putchar(i32 10)
%indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
%16 = load i32, ptr %N, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp18 = icmp slt i64 %indvars.iv.next97, %17
br i1 %cmp18, label %for.body20, label %for.end51, !llvm.loop !14
for.end51: ; preds = %for.end47, %for.end15
call void @free(ptr noundef %call1) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #6
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#define N 100
int main(){
int i,h,s,j,r;
int A[N];
int tmp,num;
scanf("%d",&num);
for(s=0;s<num;s++){
scanf("%d",&A[s]);
}
for(i=1;i<num;i++){
for(h=0;h<num-1;h++){
printf("%d ",A[h]);
}
printf("%d\n",A[num-1]);
tmp=A[i];
j=i;
while(0<j && tmp<A[j-1]){
A[j]=A[j-1];
j--;
}
A[j]=tmp;
}
for(r=0;r<num-1;r++){
printf("%d ",A[r]);
}
printf("%d\n",A[num-1]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115930/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115930/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [100 x i32], align 16
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp64 = icmp sgt i32 %0, 0
br i1 %cmp64, label %for.body, label %for.cond35.preheader.for.end44_crit_edge
for.cond2.preheader: ; preds = %for.body
%cmp370 = icmp sgt i32 %1, 1
br i1 %cmp370, label %for.cond5.preheader, label %for.cond35.preheader.for.end44_crit_edge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %num, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond2.preheader, %while.end
%3 = phi i32 [ %12, %while.end ], [ %1, %for.cond2.preheader ]
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %while.end ], [ 1, %for.cond2.preheader ]
%cmp667 = icmp sgt i32 %3, 1
br i1 %cmp667, label %for.body7, label %for.cond5.preheader.for.end13_crit_edge
for.cond5.preheader.for.end13_crit_edge: ; preds = %for.cond5.preheader
%sub66 = add nsw i32 %3, -1
%.pre = sext i32 %sub66 to i64
br label %for.end13
for.cond35.preheader: ; preds = %while.end
%cmp3773 = icmp sgt i32 %12, 1
br i1 %cmp3773, label %for.body38, label %for.cond35.preheader.for.end44_crit_edge
for.cond35.preheader.for.end44_crit_edge: ; preds = %entry, %for.cond2.preheader, %for.cond35.preheader
%4 = phi i32 [ %12, %for.cond35.preheader ], [ %1, %for.cond2.preheader ], [ %0, %entry ]
%sub3672 = add nsw i32 %4, -1
%.pre93 = sext i32 %sub3672 to i64
br label %for.end44
for.body7: ; preds = %for.cond5.preheader, %for.body7
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.body7 ], [ 0, %for.cond5.preheader ]
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv79
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%6 = load i32, ptr %num, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%7 = sext i32 %sub to i64
%cmp6 = icmp slt i64 %indvars.iv.next80, %7
br i1 %cmp6, label %for.body7, label %for.end13, !llvm.loop !11
for.end13: ; preds = %for.body7, %for.cond5.preheader.for.end13_crit_edge
%idxprom15.pre-phi = phi i64 [ %.pre, %for.cond5.preheader.for.end13_crit_edge ], [ %7, %for.body7 ]
%arrayidx16 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom15.pre-phi
%8 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx19 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv82
%9 = load i32, ptr %arrayidx19, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.end13, %while.body
%indvars.iv84 = phi i64 [ %indvars.iv82, %for.end13 ], [ %indvars.iv.next85, %while.body ]
%indvars.iv.next85 = add nsw i64 %indvars.iv84, -1
%idxprom22 = and i64 %indvars.iv.next85, 4294967295
%arrayidx23 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom22
%10 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp slt i32 %9, %10
br i1 %cmp24, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx29 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv84
store i32 %10, ptr %arrayidx29, align 4, !tbaa !5
%11 = icmp sgt i64 %indvars.iv84, 1
br i1 %11, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv84, %land.rhs ]
%sext = shl i64 %j.0.lcssa, 32
%idxprom30 = ashr exact i64 %sext, 32
%arrayidx31 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom30
store i32 %9, ptr %arrayidx31, align 4, !tbaa !5
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%12 = load i32, ptr %num, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp3 = icmp slt i64 %indvars.iv.next83, %13
br i1 %cmp3, label %for.cond5.preheader, label %for.cond35.preheader, !llvm.loop !13
for.body38: ; preds = %for.cond35.preheader, %for.body38
%indvars.iv89 = phi i64 [ %indvars.iv.next90, %for.body38 ], [ 0, %for.cond35.preheader ]
%arrayidx40 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv89
%14 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%15 = load i32, ptr %num, align 4, !tbaa !5
%sub36 = add nsw i32 %15, -1
%16 = sext i32 %sub36 to i64
%cmp37 = icmp slt i64 %indvars.iv.next90, %16
br i1 %cmp37, label %for.body38, label %for.end44, !llvm.loop !14
for.end44: ; preds = %for.body38, %for.cond35.preheader.for.end44_crit_edge
%idxprom46.pre-phi = phi i64 [ %.pre93, %for.cond35.preheader.for.end44_crit_edge ], [ %16, %for.body38 ]
%arrayidx47 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom46.pre-phi
%17 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #3
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
void trace(int A[], int N){
int i;
for(i=0; i<N; i++)
{
if(i>0)
printf(" ");
printf("%d",A[i]);
}
printf("\n");
}
void insertionSort(int A[], int N){
int j, i, v;
for(i=1; i<N; i++)
{
v=A[i];
j=i-1;
while(j>=0 && A[j]>v)
{
A[j+1]=A[j];
j--;
}
A[j+1]=v;
trace(A, N);
}
}
int main(){
int N, i, j;
int A[100];
scanf("%d", &N);
for(i=0;i<N; i++)
scanf("%d", &A[i]);
trace(A,N);
insertionSort(A,N);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_115974/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_115974/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @trace(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp8 = icmp sgt i32 %N, 0
br i1 %cmp8, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%.pre = load i32, ptr %A, align 4, !tbaa !5
%call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %N, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar7 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp30 = icmp sgt i32 %N, 1
br i1 %cmp30, label %for.body.us.preheader, label %for.end
for.body.us.preheader: ; preds = %entry
%wide.trip.count.i = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %trace.exit.loopexit.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %trace.exit.loopexit.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next35 = add nsw i64 %indvars.iv34, -1
%idxprom2.us = and i64 %indvars.iv.next35, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us
%1 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp sgt i32 %1, %0
br i1 %cmp4.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv34, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom10.us = ashr exact i64 %sext, 32
%arrayidx11.us = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us
store i32 %0, ptr %arrayidx11.us, align 4, !tbaa !5
%.pre.i.us = load i32, ptr %A, align 4, !tbaa !5
%call2.peel.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us)
br label %if.end.i.us
if.end.i.us: ; preds = %while.end.us, %if.end.i.us
%indvars.iv.i.us = phi i64 [ %indvars.iv.next.i.us, %if.end.i.us ], [ 1, %while.end.us ]
%putchar7.i.us = tail call i32 @putchar(i32 32)
%arrayidx.i.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us
%2 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%call2.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %trace.exit.loopexit.us, label %if.end.i.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv34
store i32 %1, ptr %arrayidx8.us, align 4, !tbaa !5
%3 = icmp sgt i64 %indvars.iv34, 1
br i1 %3, label %land.rhs.us, label %while.end.us, !llvm.loop !12
trace.exit.loopexit.us: ; preds = %if.end.i.us
%putchar.i.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count.i
br i1 %exitcond.not, label %for.end, label %for.body.us, !llvm.loop !13
for.end: ; preds = %trace.exit.loopexit.us, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %0, 0
br i1 %cmp8, label %for.body, label %trace.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.body
%cmp8.i = icmp sgt i32 %1, 0
br i1 %cmp8.i, label %if.end.peel.i, label %trace.exit
if.end.peel.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %1 to i64
%.pre.i = load i32, ptr %A, align 16, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %1, 1
br i1 %exitcond.peel.not.i, label %trace.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar7.i = call i32 @putchar(i32 32)
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %trace.exit, label %if.end.i, !llvm.loop !9
trace.exit: ; preds = %if.end.i, %entry, %for.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp30.i = icmp sgt i32 %4, 1
br i1 %cmp30.i, label %for.body.us.preheader.i, label %insertionSort.exit
for.body.us.preheader.i: ; preds = %trace.exit
%wide.trip.count.i.i = zext i32 %4 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %trace.exit.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv.i5 = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i6, %trace.exit.loopexit.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i5
%5 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv34.i = phi i64 [ %indvars.iv.next35.i, %while.body.us.i ], [ %indvars.iv.i5, %for.body.us.i ]
%indvars.iv.next35.i = add nsw i64 %indvars.iv34.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next35.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us.i
%6 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp sgt i32 %6, %5
br i1 %cmp4.us.i, label %while.body.us.i, label %while.end.us.i
while.end.us.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv34.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom10.us.i = ashr exact i64 %sext.i, 32
%arrayidx11.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us.i
store i32 %5, ptr %arrayidx11.us.i, align 4, !tbaa !5
%.pre.i.us.i = load i32, ptr %A, align 16, !tbaa !5
%call2.peel.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i.us.i)
br label %if.end.i.us.i
if.end.i.us.i: ; preds = %if.end.i.us.i, %while.end.us.i
%indvars.iv.i.us.i = phi i64 [ %indvars.iv.next.i.us.i, %if.end.i.us.i ], [ 1, %while.end.us.i ]
%putchar7.i.us.i = call i32 @putchar(i32 32)
%arrayidx.i.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.us.i
%7 = load i32, ptr %arrayidx.i.us.i, align 4, !tbaa !5
%call2.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next.i.us.i = add nuw nsw i64 %indvars.iv.i.us.i, 1
%exitcond.not.i.us.i = icmp eq i64 %indvars.iv.next.i.us.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.us.i, label %trace.exit.loopexit.us.i, label %if.end.i.us.i, !llvm.loop !9
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv34.i
store i32 %6, ptr %arrayidx8.us.i, align 4, !tbaa !5
%8 = icmp sgt i64 %indvars.iv34.i, 1
br i1 %8, label %land.rhs.us.i, label %while.end.us.i, !llvm.loop !12
trace.exit.loopexit.us.i: ; preds = %if.end.i.us.i
%putchar.i.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i6 = add nuw nsw i64 %indvars.iv.i5, 1
%exitcond.not.i7 = icmp eq i64 %indvars.iv.next.i6, %wide.trip.count.i.i
br i1 %exitcond.not.i7, label %insertionSort.exit, label %for.body.us.i, !llvm.loop !13
insertionSort.exit: ; preds = %trace.exit.loopexit.us.i, %trace.exit
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
void insertionSort(int A[], int N);
int A[100];
int main(void){
int N, i, y;
scanf("%d",&N);
for(i = 0; i < N; i++){
scanf("%d",&y);
A[i] = y;
if(i > 0) printf(" ");
printf("%d",A[i]);
}
printf("\n");
insertionSort(A, N);
return 0;
}
void insertionSort(int A[], int N){
int i, j, k, v;
for(i = 1; i < N; i++){
v = A[i];
j = i - 1;
while(j >= 0 && A[j] > v){
A[j+1] = A[j];
j--;
A[j+1] = v;
}
for(k = 0; k < N; k++){
if(k > 0) printf(" ");
printf("%d",A[k]);
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116016/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116016/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@A = dso_local 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:
%N = alloca i32, align 4
%y = 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 %y) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %0, 0
br i1 %cmp13, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%call1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y)
%1 = load i32, ptr %y, align 4, !tbaa !5
store i32 %1, ptr @A, align 16, !tbaa !5
%call6.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load i32, ptr %N, align 4, !tbaa !5
%cmp.peel = icmp sgt i32 %2, 1
br i1 %cmp.peel, label %if.end, label %for.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y)
%3 = load i32, ptr %y, align 4, !tbaa !5
%arrayidx = getelementptr inbounds [100 x i32], ptr @A, i64 0, i64 %indvars.iv
store i32 %3, ptr %arrayidx, align 4, !tbaa !5
%putchar12 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %arrayidx, align 4, !tbaa !5
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %if.end, label %for.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = call i32 @putchar(i32 10)
%6 = load i32, ptr %N, align 4, !tbaa !5
%cmp48.i = icmp sgt i32 %6, 1
br i1 %cmp48.i, label %for.body.us.preheader.i, label %insertionSort.exit
for.body.us.preheader.i: ; preds = %for.end
%wide.trip.count61.i = zext i32 %6 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond12.for.end_crit_edge.us.i, %for.body.us.preheader.i
%indvars.iv.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i, %for.cond12.for.end_crit_edge.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr @A, i64 %indvars.iv.i
%7 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv51.i = phi i64 [ %indvars.iv.next52.i, %while.body.us.i ], [ %indvars.iv.i, %for.body.us.i ]
%indvars.iv.next52.i = add nsw i64 %indvars.iv51.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next52.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr @A, i64 %idxprom2.us.i
%8 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp sgt i32 %8, %7
br i1 %cmp4.us.i, label %while.body.us.i, label %if.end.us.peel.i
if.end.us.peel.i: ; preds = %while.body.us.i, %land.rhs.us.i
%.pre.i = load i32, ptr @A, align 16, !tbaa !5
%call18.us.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre.i)
br label %if.end.us.i
if.end.us.i: ; preds = %if.end.us.i, %if.end.us.peel.i
%indvars.iv54.i = phi i64 [ %indvars.iv.next55.i, %if.end.us.i ], [ 1, %if.end.us.peel.i ]
%putchar42.us.i = call i32 @putchar(i32 32)
%arrayidx17.us.i = getelementptr inbounds i32, ptr @A, i64 %indvars.iv54.i
%9 = load i32, ptr %arrayidx17.us.i, align 4, !tbaa !5
%call18.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9)
%indvars.iv.next55.i = add nuw nsw i64 %indvars.iv54.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next55.i, %wide.trip.count61.i
br i1 %exitcond.not.i, label %for.cond12.for.end_crit_edge.us.i, label %if.end.us.i, !llvm.loop !12
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr @A, i64 %indvars.iv51.i
store i32 %8, ptr %arrayidx8.us.i, align 4, !tbaa !5
store i32 %7, ptr %arrayidx3.us.i, align 4, !tbaa !5
%10 = icmp sgt i64 %indvars.iv51.i, 1
br i1 %10, label %land.rhs.us.i, label %if.end.us.peel.i, !llvm.loop !13
for.cond12.for.end_crit_edge.us.i: ; preds = %if.end.us.i
%putchar.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond62.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count61.i
br i1 %exitcond62.not.i, label %insertionSort.exit, label %for.body.us.i, !llvm.loop !14
insertionSort.exit: ; preds = %for.cond12.for.end_crit_edge.us.i, %for.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp48 = icmp sgt i32 %N, 1
br i1 %cmp48, label %for.body.us.preheader, label %for.end22
for.body.us.preheader: ; preds = %entry
%wide.trip.count61 = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond12.for.end_crit_edge.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %for.cond12.for.end_crit_edge.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next52 = add nsw i64 %indvars.iv51, -1
%idxprom2.us = and i64 %indvars.iv.next52, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us
%1 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp sgt i32 %1, %0
br i1 %cmp4.us, label %while.body.us, label %if.end.us.peel
if.end.us.peel: ; preds = %while.body.us, %land.rhs.us
%.pre = load i32, ptr %A, align 4, !tbaa !5
%call18.us.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
br label %if.end.us
if.end.us: ; preds = %if.end.us.peel, %if.end.us
%indvars.iv54 = phi i64 [ %indvars.iv.next55, %if.end.us ], [ 1, %if.end.us.peel ]
%putchar42.us = tail call i32 @putchar(i32 32)
%arrayidx17.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv54
%2 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5
%call18.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count61
br i1 %exitcond.not, label %for.cond12.for.end_crit_edge.us, label %if.end.us, !llvm.loop !12
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv51
store i32 %1, ptr %arrayidx8.us, align 4, !tbaa !5
store i32 %0, ptr %arrayidx3.us, align 4, !tbaa !5
%3 = icmp sgt i64 %indvars.iv51, 1
br i1 %3, label %land.rhs.us, label %if.end.us.peel, !llvm.loop !13
for.cond12.for.end_crit_edge.us: ; preds = %if.end.us
%putchar.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond62.not = icmp eq i64 %indvars.iv.next, %wide.trip.count61
br i1 %exitcond62.not, label %for.end22, label %for.body.us, !llvm.loop !14
for.end22: ; preds = %for.cond12.for.end_crit_edge.us, %entry
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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10, !11}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main(){
int h[100000];
int n,cost,m,temp;
int i=0,j=1;
scanf("%d ", &n);
for(;i<n;++i){
scanf("%d", &h[i]);
}
cost=n+h[0];
while(j<n){
if(h[j]>h[j-1]){
cost+=h[j]-h[j-1]+1;
}else if(h[j]==h[j-1]){
cost+=1;
}else{
cost+=h[j-1]-h[j]+1;
}
++j;
}
printf("%d", cost);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11606/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11606/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca [100000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %h) #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
%cmp55 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp55)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%.pre = load i32, ptr %h, align 16, !tbaa !5
%add = add nsw i32 %.pre, %1
%cmp357 = icmp sgt i32 %1, 1
br i1 %cmp357, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %1 to i64
%3 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %1, 9
br i1 %min.iters.check, label %while.body.preheader75, label %vector.ph
vector.ph: ; preds = %while.body.preheader
%n.vec = and i64 %3, -8
%ind.end = or i64 %n.vec, 1
%vector.recur.init = insertelement <4 x i32> poison, i32 %.pre, i64 3
%4 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %add, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %wide.load71, %vector.body ]
%vec.phi = phi <4 x i32> [ %4, %vector.ph ], [ %21, %vector.body ]
%vec.phi70 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %22, %vector.body ]
%offset.idx = or i64 %index, 1
%5 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load71 = load <4 x i32>, ptr %6, align 4, !tbaa !5
%7 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%8 = shufflevector <4 x i32> %wide.load, <4 x i32> %wide.load71, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%9 = icmp eq <4 x i32> %wide.load, %7
%10 = icmp eq <4 x i32> %wide.load71, %8
%11 = sub <4 x i32> %7, %wide.load
%12 = sub <4 x i32> %8, %wide.load71
%13 = add <4 x i32> %11, <i32 1, i32 1, i32 1, i32 1>
%14 = add <4 x i32> %12, <i32 1, i32 1, i32 1, i32 1>
%15 = add <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%16 = add <4 x i32> %wide.load71, <i32 1, i32 1, i32 1, i32 1>
%17 = sub <4 x i32> %15, %7
%18 = sub <4 x i32> %16, %8
%19 = icmp slt <4 x i32> %wide.load, %7
%20 = icmp slt <4 x i32> %wide.load71, %8
%predphi = select <4 x i1> %19, <4 x i32> %13, <4 x i32> %17
%predphi72 = select <4 x i1> %20, <4 x i32> %14, <4 x i32> %18
%predphi73 = select <4 x i1> %9, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %predphi
%predphi74 = select <4 x i1> %10, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %predphi72
%21 = add <4 x i32> %predphi73, %vec.phi
%22 = add <4 x i32> %predphi74, %vec.phi70
%index.next = add nuw i64 %index, 8
%23 = icmp eq i64 %index.next, %n.vec
br i1 %23, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %22, %21
%24 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %3, %n.vec
%vector.recur.extract = extractelement <4 x i32> %wide.load71, i64 3
br i1 %cmp.n, label %while.end, label %while.body.preheader75
while.body.preheader75: ; preds = %while.body.preheader, %middle.block
%scalar.recur.ph = phi i32 [ %vector.recur.extract, %middle.block ], [ %.pre, %while.body.preheader ]
%indvars.iv63.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %while.body.preheader ]
%cost.058.ph = phi i32 [ %24, %middle.block ], [ %add, %while.body.preheader ]
br label %while.body
while.body: ; preds = %while.body.preheader75, %if.end34
%scalar.recur = phi i32 [ %25, %if.end34 ], [ %scalar.recur.ph, %while.body.preheader75 ]
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %if.end34 ], [ %indvars.iv63.ph, %while.body.preheader75 ]
%cost.058 = phi i32 [ %cost.1, %if.end34 ], [ %cost.058.ph, %while.body.preheader75 ]
%arrayidx5 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv63
%25 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %25, %scalar.recur
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %while.body
%sub14 = add i32 %25, 1
%add15 = sub i32 %sub14, %scalar.recur
br label %if.end34
if.else: ; preds = %while.body
%cmp22 = icmp eq i32 %25, %scalar.recur
br i1 %cmp22, label %if.end34, label %if.else25
if.else25: ; preds = %if.else
%reass.sub = sub i32 %scalar.recur, %25
%add32 = add i32 %reass.sub, 1
br label %if.end34
if.end34: ; preds = %if.else, %if.else25, %if.then
%add15.pn = phi i32 [ %add15, %if.then ], [ %add32, %if.else25 ], [ 1, %if.else ]
%cost.1 = add nsw i32 %add15.pn, %cost.058
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%exitcond.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count
br i1 %exitcond.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %if.end34, %middle.block, %for.end
%cost.0.lcssa = phi i32 [ %add, %for.end ], [ %24, %middle.block ], [ %cost.1, %if.end34 ]
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cost.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %h) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: 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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
|
#include<stdio.h>
static const int N = 1000;
void trace(int A[], int n){
int i;
for ( i = 1; i <= n; i++ ){
if ( i > 1 ) printf(" ");
printf("%d", A[i]);
}
printf("\n");
}
int main(){
int n, i, j;
int A[N+1];
int key;
scanf("%d", &n);
for ( i = 1; i <= n; i++ )
scanf("%d", &A[i]);
for ( i = 1; i <= n; i++ ){
key = A[i];
j = i - 1;
while(j > 0 && A[j] > key){
A[j+1] = A[j];
j--;
}
A[j+1] = key;
trace(A, n);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116102/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116102/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @trace(ptr nocapture noundef readonly %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp.not8 = icmp slt i32 %n, 1
br i1 %cmp.not8, label %for.end, label %if.end.peel
if.end.peel: ; preds = %entry
%0 = add nuw i32 %n, 1
%wide.trip.count = zext i32 %0 to i64
%arrayidx.peel.phi.trans.insert = getelementptr inbounds i32, ptr %A, i64 1
%.pre = load i32, ptr %arrayidx.peel.phi.trans.insert, align 4, !tbaa !5
%call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %0, 2
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 2, %if.end.peel ]
%putchar7 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%0 = tail call ptr @llvm.stacksave.p0()
%vla33 = alloca [1001 x i32], align 16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not34 = icmp slt i32 %1, 1
br i1 %cmp.not34, label %for.end20, label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp3.not42 = icmp slt i32 %2, 1
br i1 %cmp3.not42, label %for.end20, label %for.body4.lr.ph
for.body4.lr.ph: ; preds = %for.cond2.preheader
%arrayidx.peel.phi.trans.insert.i = getelementptr inbounds i32, ptr %vla33, i64 1
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla33, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !12
for.body4: ; preds = %for.body4.lr.ph, %trace.exit
%indvars.iv46 = phi i64 [ 1, %for.body4.lr.ph ], [ %indvars.iv.next47, %trace.exit ]
%4 = phi i32 [ %2, %for.body4.lr.ph ], [ %.pr, %trace.exit ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla33, i64 %indvars.iv46
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp737 = icmp ugt i64 %indvars.iv46, 1
br i1 %cmp737, label %land.rhs, label %while.end
land.rhs: ; preds = %for.body4, %while.body
%indvars.iv48 = phi i64 [ %indvars.iv.next49, %while.body ], [ %indvars.iv46, %for.body4 ]
%indvars.iv.next49 = add nsw i64 %indvars.iv48, -1
%idxprom8 = and i64 %indvars.iv.next49, 4294967295
%arrayidx9 = getelementptr inbounds i32, ptr %vla33, i64 %idxprom8
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %6, %5
br i1 %cmp10, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds i32, ptr %vla33, i64 %indvars.iv48
store i32 %6, ptr %arrayidx14, align 4, !tbaa !5
%7 = icmp sgt i64 %indvars.iv48, 2
br i1 %7, label %land.rhs, label %while.end, !llvm.loop !13
while.end: ; preds = %land.rhs, %while.body, %for.body4
%j.0.in.lcssa = phi i64 [ %indvars.iv46, %for.body4 ], [ 1, %while.body ], [ %indvars.iv48, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom16 = ashr exact i64 %sext, 32
%arrayidx17 = getelementptr inbounds i32, ptr %vla33, i64 %idxprom16
store i32 %5, ptr %arrayidx17, align 4, !tbaa !5
%cmp.not8.i = icmp slt i32 %4, 1
br i1 %cmp.not8.i, label %trace.exit, label %if.end.peel.i
if.end.peel.i: ; preds = %while.end
%8 = add nuw i32 %4, 1
%wide.trip.count.i = zext i32 %8 to i64
%.pre.i = load i32, ptr %arrayidx.peel.phi.trans.insert.i, align 4, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %8, 2
br i1 %exitcond.peel.not.i, label %trace.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 2, %if.end.peel.i ]
%putchar7.i = call i32 @putchar(i32 32)
%arrayidx.i = getelementptr inbounds i32, ptr %vla33, i64 %indvars.iv.i
%9 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %trace.exit, label %if.end.i, !llvm.loop !9
trace.exit: ; preds = %if.end.i, %while.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%.pr = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %.pr to i64
%cmp3.not.not = icmp slt i64 %indvars.iv46, %10
br i1 %cmp3.not.not, label %for.body4, label %for.end20, !llvm.loop !14
for.end20: ; preds = %trace.exit, %entry, %for.cond2.preheader
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#ifdef DEBUG
#include<conio.h>
#endif // DEBUG
int nums[105];
int main () {
#ifdef DEBUG
freopen("input.txt", "r", stdin);
#endif // DEBUG
int num;
scanf("%d", &num);
for (int i = 0; i < num; i++)
{
scanf("%d", &nums[i]);
}
if(1 == num) printf("%d\n", nums[0]);
else {
printf("%d", nums[0]);
for (size_t i = 1; i < num; i++)
{
printf(" %d", nums[i]);
}
printf("\n");
for(int i = 1; i < num; ++i) {
int tmp = nums[i];
int j = i - 1;
while(j >= 0 && tmp < nums[j]) {
nums[j + 1] = nums[j];
j--;
}
nums[j + 1] = tmp;
printf("%d", nums[0]);
for (size_t i = 1; i < num; i++)
{
printf(" %d", nums[i]);
}
printf("\n");
}
}
#ifdef DEBUG
getch();
#endif // DEBUG
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116160/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116160/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
@nums = dso_local global [105 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp72 = icmp sgt i32 %0, 0
br i1 %cmp72, label %for.body, label %if.else
for.cond.cleanup: ; preds = %for.body
%1 = icmp eq i32 %2, 1
br i1 %1, label %if.then, label %if.else
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [105 x i32], ptr @nums, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %num, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
if.then: ; preds = %for.cond.cleanup
%4 = load i32, ptr @nums, align 16, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
br label %if.end
if.else: ; preds = %entry, %for.cond.cleanup
%5 = load i32, ptr @nums, align 16, !tbaa !5
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%6 = load i32, ptr %num, align 4, !tbaa !5
%cmp775 = icmp ugt i32 %6, 1
br i1 %cmp775, label %for.body10, label %for.cond.cleanup9
for.cond.cleanup9: ; preds = %for.body10, %if.else
%putchar = call i32 @putchar(i32 10)
%7 = load i32, ptr %num, align 4, !tbaa !5
%cmp1983 = icmp sgt i32 %7, 1
br i1 %cmp1983, label %for.body22, label %if.end
for.body10: ; preds = %if.else, %for.body10
%i5.076 = phi i64 [ %inc14, %for.body10 ], [ 1, %if.else ]
%arrayidx11 = getelementptr inbounds [105 x i32], ptr @nums, i64 0, i64 %i5.076
%8 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%inc14 = add nuw i64 %i5.076, 1
%9 = load i32, ptr %num, align 4, !tbaa !5
%conv = sext i32 %9 to i64
%cmp7 = icmp ult i64 %inc14, %conv
br i1 %cmp7, label %for.body10, label %for.cond.cleanup9, !llvm.loop !11
for.body22: ; preds = %for.cond.cleanup9, %for.cond.cleanup44
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.cond.cleanup44 ], [ 1, %for.cond.cleanup9 ]
%arrayidx24 = getelementptr inbounds [105 x i32], ptr @nums, i64 0, i64 %indvars.iv87
%10 = load i32, ptr %arrayidx24, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body22, %while.body
%indvars.iv89 = phi i64 [ %indvars.iv87, %for.body22 ], [ %indvars.iv.next90, %while.body ]
%indvars.iv.next90 = add nsw i64 %indvars.iv89, -1
%idxprom27 = and i64 %indvars.iv.next90, 4294967295
%arrayidx28 = getelementptr inbounds [105 x i32], ptr @nums, i64 0, i64 %idxprom27
%11 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp29 = icmp slt i32 %10, %11
br i1 %cmp29, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx34 = getelementptr inbounds [105 x i32], ptr @nums, i64 0, i64 %indvars.iv89
store i32 %11, ptr %arrayidx34, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv89, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv89, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom36 = ashr exact i64 %sext, 32
%arrayidx37 = getelementptr inbounds [105 x i32], ptr @nums, i64 0, i64 %idxprom36
store i32 %10, ptr %arrayidx37, align 4, !tbaa !5
%13 = load i32, ptr @nums, align 16, !tbaa !5
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
%14 = load i32, ptr %num, align 4, !tbaa !5
%cmp4281 = icmp ugt i32 %14, 1
br i1 %cmp4281, label %for.body45, label %for.cond.cleanup44
for.cond.cleanup44: ; preds = %for.body45, %while.end
%putchar71 = call i32 @putchar(i32 10)
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%15 = load i32, ptr %num, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp19 = icmp slt i64 %indvars.iv.next88, %16
br i1 %cmp19, label %for.body22, label %if.end, !llvm.loop !13
for.body45: ; preds = %while.end, %for.body45
%i39.082 = phi i64 [ %inc49, %for.body45 ], [ 1, %while.end ]
%arrayidx46 = getelementptr inbounds [105 x i32], ptr @nums, i64 0, i64 %i39.082
%17 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%inc49 = add nuw i64 %i39.082, 1
%18 = load i32, ptr %num, align 4, !tbaa !5
%conv41 = sext i32 %18 to i64
%cmp42 = icmp ult i64 %inc49, %conv41
br i1 %cmp42, label %for.body45, label %for.cond.cleanup44, !llvm.loop !14
if.end: ; preds = %for.cond.cleanup44, %for.cond.cleanup9, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(){
//reading in data
//FILE* fp = fopen("input.txt","r");
int c;
//fscanf(fp,"%i",&c);
scanf(" %i",&c);
//printf("\n%i\n\n",c);
int nums[c];
for(int i=0; i<c; i++){
//fscanf(fp,"%i",&nums[i]);
scanf(" %i",&nums[i]);
if(i>c-2){
printf("%i\n",nums[i]);
}else{
printf("%i ",nums[i]);
}
}
//insertion sort algorithm
for(int i=1; i<c; i++){
int key = nums[i];
//sorting
int j = i-1;
while(j>=0 && nums[j]>key){
nums[j+1] = nums[j];
j--;
}
nums[j+1] = key;
for(int k=0; k<c; k++){
if(k>c-2){
printf("%i\n",nums[k]);
}else{
printf("%i ",nums[k]);
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116210/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116210/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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" %i\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%i\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%i \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca i32, align 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 %c)
%0 = load i32, ptr %c, 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 %c, align 4, !tbaa !5
%cmp68 = icmp sgt i32 %3, 0
br i1 %cmp68, label %for.body, label %for.cond.cleanup12
for.cond10.preheader: ; preds = %for.body
%cmp1175 = icmp sgt i32 %7, 1
br i1 %cmp1175, label %for.body13, label %for.cond.cleanup12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%4 = load i32, ptr %c, align 4, !tbaa !5
%sub = add nsw i32 %4, -2
%5 = sext i32 %sub to i64
%cmp2 = icmp sgt i64 %indvars.iv, %5
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%.str.1..str.2 = select i1 %cmp2, ptr @.str.1, ptr @.str.2
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2, i32 noundef %6)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %c, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.cond10.preheader, !llvm.loop !9
for.cond.cleanup12: ; preds = %for.cond.cleanup30, %entry, %for.cond10.preheader
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
ret i32 0
for.body13: ; preds = %for.cond10.preheader, %for.cond.cleanup30
%9 = phi i32 [ %13, %for.cond.cleanup30 ], [ %7, %for.cond10.preheader ]
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.cond.cleanup30 ], [ 1, %for.cond10.preheader ]
%arrayidx15 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv78
%10 = load i32, ptr %arrayidx15, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body13, %while.body
%indvars.iv80 = phi i64 [ %indvars.iv78, %for.body13 ], [ %indvars.iv.next81, %while.body ]
%indvars.iv.next81 = add nsw i64 %indvars.iv80, -1
%idxprom18 = and i64 %indvars.iv.next81, 4294967295
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %idxprom18
%11 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %11, %10
br i1 %cmp20, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx24 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv80
store i32 %11, ptr %arrayidx24, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv80, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv80, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom26 = ashr exact i64 %sext, 32
%arrayidx27 = getelementptr inbounds i32, ptr %vla, i64 %idxprom26
store i32 %10, ptr %arrayidx27, align 4, !tbaa !5
%cmp2973 = icmp sgt i32 %9, 0
br i1 %cmp2973, label %for.body31, label %while.end.for.cond.cleanup30_crit_edge
while.end.for.cond.cleanup30_crit_edge: ; preds = %while.end
%.pre = sext i32 %9 to i64
br label %for.cond.cleanup30
for.cond.cleanup30: ; preds = %for.body31, %while.end.for.cond.cleanup30_crit_edge
%.pre-phi = phi i64 [ %.pre, %while.end.for.cond.cleanup30_crit_edge ], [ %18, %for.body31 ]
%13 = phi i32 [ %9, %while.end.for.cond.cleanup30_crit_edge ], [ %17, %for.body31 ]
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%cmp11 = icmp slt i64 %indvars.iv.next79, %.pre-phi
br i1 %cmp11, label %for.body13, label %for.cond.cleanup12, !llvm.loop !12
for.body31: ; preds = %while.end, %for.body31
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.body31 ], [ 0, %while.end ]
%14 = phi i32 [ %17, %for.body31 ], [ %9, %while.end ]
%sub32 = add nsw i32 %14, -2
%15 = sext i32 %sub32 to i64
%cmp33 = icmp sgt i64 %indvars.iv83, %15
%arrayidx36 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv83
%16 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%.str.1..str.293 = select i1 %cmp33, ptr @.str.1, ptr @.str.2
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.293, i32 noundef %16)
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%17 = load i32, ptr %c, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp29 = icmp slt i64 %indvars.iv.next84, %18
br i1 %cmp29, label %for.body31, label %for.cond.cleanup30, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
void dump_arr(int arr[], int n){
int i;
for(i = 0; i < n; i++){
printf("%d%s", arr[i], (i == n - 1) ? "\n" : " ");
}
}
void insertion_sort(int arr[], int n){
int i, j;
for(i = 1; i < n; i++){
int tmp = arr[i];
for(j = i - 1; j >= 0 && arr[j] > tmp; j--){
arr[j + 1] = arr[j];
}
arr[j + 1] = tmp;
dump_arr(arr, n);
}
}
int main(){
int i, n, arr[100];
scanf("%d", &n);
for(i = 0; i < n; i++){
getchar();
scanf("%d", &arr[i]);
}
dump_arr(arr, n);
insertion_sort(arr, n);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116254/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116254/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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%s\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c" \00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local void @dump_arr(ptr nocapture noundef readonly %arr, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp6 = icmp sgt i32 %n, 0
br i1 %cmp6, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%sub = add nsw i32 %n, -1
%0 = zext i32 %sub to i64
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i64 %indvars.iv, %0
%cond = select i1 %cmp1, ptr @.str.1, ptr @.str.2
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1, ptr noundef nonnull %cond)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insertion_sort(ptr nocapture noundef %arr, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp34 = icmp sgt i32 %n, 1
br i1 %cmp34, label %for.body.us.preheader, label %for.end15
for.body.us.preheader: ; preds = %entry
%sub.i = add nsw i32 %n, -1
%0 = zext i32 %sub.i to i64
%wide.trip.count.i = zext i32 %n to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %dump_arr.exit.loopexit.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %dump_arr.exit.loopexit.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
%1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %for.body6.us, %for.body.us
%indvars.iv37 = phi i64 [ %indvars.iv.next38, %for.body6.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next38 = add nsw i64 %indvars.iv37, -1
%idxprom3.us = and i64 %indvars.iv.next38, 4294967295
%arrayidx4.us = getelementptr inbounds i32, ptr %arr, i64 %idxprom3.us
%2 = load i32, ptr %arrayidx4.us, align 4, !tbaa !5
%cmp5.us = icmp sgt i32 %2, %1
br i1 %cmp5.us, label %for.body6.us, label %for.end.us
for.end.us: ; preds = %for.body6.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %for.body6.us ], [ %indvars.iv37, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom12.us = ashr exact i64 %sext, 32
%arrayidx13.us = getelementptr inbounds i32, ptr %arr, i64 %idxprom12.us
store i32 %1, ptr %arrayidx13.us, align 4, !tbaa !5
br label %for.body.i.us
for.body.i.us: ; preds = %for.body.i.us, %for.end.us
%indvars.iv.i.us = phi i64 [ 0, %for.end.us ], [ %indvars.iv.next.i.us, %for.body.i.us ]
%arrayidx.i.us = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv.i.us
%3 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%cmp1.i.us = icmp eq i64 %indvars.iv.i.us, %0
%cond.i.us = select i1 %cmp1.i.us, ptr @.str.1, ptr @.str.2
%call.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3, ptr noundef nonnull %cond.i.us)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %dump_arr.exit.loopexit.us, label %for.body.i.us, !llvm.loop !9
for.body6.us: ; preds = %land.rhs.us
%arrayidx10.us = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv37
store i32 %2, ptr %arrayidx10.us, align 4, !tbaa !5
%4 = icmp sgt i64 %indvars.iv37, 1
br i1 %4, label %land.rhs.us, label %for.end.us, !llvm.loop !11
dump_arr.exit.loopexit.us: ; preds = %for.body.i.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count.i
br i1 %exitcond.not, label %for.end15, label %for.body.us, !llvm.loop !12
for.end15: ; preds = %dump_arr.exit.loopexit.us, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%arr = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %arr) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %insertion_sort.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%1 = load ptr, ptr @stdin, align 8, !tbaa !13
%call.i = call i32 @getc(ptr noundef %1)
%arrayidx = getelementptr inbounds [100 x i32], ptr %arr, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !15
for.end: ; preds = %for.body
%cmp6.i = icmp sgt i32 %2, 0
br i1 %cmp6.i, label %for.body.lr.ph.i, label %insertion_sort.exit
for.body.lr.ph.i: ; preds = %for.end
%sub.i = add nsw i32 %2, -1
%4 = zext i32 %sub.i to i64
%wide.trip.count.i = zext i32 %2 to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.lr.ph.i
%indvars.iv.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next.i, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv.i
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i64 %indvars.iv.i, %4
%cond.i = select i1 %cmp1.i, ptr @.str.1, ptr @.str.2
%call.i6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5, ptr noundef nonnull %cond.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
br i1 %exitcond.not.i, label %dump_arr.exit, label %for.body.i, !llvm.loop !9
dump_arr.exit: ; preds = %for.body.i
%.pr = load i32, ptr %n, align 4, !tbaa !5
%cmp34.i = icmp sgt i32 %.pr, 1
br i1 %cmp34.i, label %for.body.us.preheader.i, label %insertion_sort.exit
for.body.us.preheader.i: ; preds = %dump_arr.exit
%sub.i.i = add nsw i32 %.pr, -1
%6 = zext i32 %sub.i.i to i64
%wide.trip.count.i.i = zext i32 %.pr to i64
br label %for.body.us.i
for.body.us.i: ; preds = %dump_arr.exit.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv.i7 = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i8, %dump_arr.exit.loopexit.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv.i7
%7 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %for.body6.us.i, %for.body.us.i
%indvars.iv37.i = phi i64 [ %indvars.iv.next38.i, %for.body6.us.i ], [ %indvars.iv.i7, %for.body.us.i ]
%indvars.iv.next38.i = add nsw i64 %indvars.iv37.i, -1
%idxprom3.us.i = and i64 %indvars.iv.next38.i, 4294967295
%arrayidx4.us.i = getelementptr inbounds i32, ptr %arr, i64 %idxprom3.us.i
%8 = load i32, ptr %arrayidx4.us.i, align 4, !tbaa !5
%cmp5.us.i = icmp sgt i32 %8, %7
br i1 %cmp5.us.i, label %for.body6.us.i, label %for.end.us.i
for.end.us.i: ; preds = %for.body6.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %for.body6.us.i ], [ %indvars.iv37.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom12.us.i = ashr exact i64 %sext.i, 32
%arrayidx13.us.i = getelementptr inbounds i32, ptr %arr, i64 %idxprom12.us.i
store i32 %7, ptr %arrayidx13.us.i, align 4, !tbaa !5
br label %for.body.i.us.i
for.body.i.us.i: ; preds = %for.body.i.us.i, %for.end.us.i
%indvars.iv.i.us.i = phi i64 [ 0, %for.end.us.i ], [ %indvars.iv.next.i.us.i, %for.body.i.us.i ]
%arrayidx.i.us.i = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv.i.us.i
%9 = load i32, ptr %arrayidx.i.us.i, align 4, !tbaa !5
%cmp1.i.us.i = icmp eq i64 %indvars.iv.i.us.i, %6
%cond.i.us.i = select i1 %cmp1.i.us.i, ptr @.str.1, ptr @.str.2
%call.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9, ptr noundef nonnull %cond.i.us.i)
%indvars.iv.next.i.us.i = add nuw nsw i64 %indvars.iv.i.us.i, 1
%exitcond.not.i.us.i = icmp eq i64 %indvars.iv.next.i.us.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.us.i, label %dump_arr.exit.loopexit.us.i, label %for.body.i.us.i, !llvm.loop !9
for.body6.us.i: ; preds = %land.rhs.us.i
%arrayidx10.us.i = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv37.i
store i32 %8, ptr %arrayidx10.us.i, align 4, !tbaa !5
%10 = icmp sgt i64 %indvars.iv37.i, 1
br i1 %10, label %land.rhs.us.i, label %for.end.us.i, !llvm.loop !11
dump_arr.exit.loopexit.us.i: ; preds = %for.body.i.us.i
%indvars.iv.next.i8 = add nuw nsw i64 %indvars.iv.i7, 1
%exitcond.not.i9 = icmp eq i64 %indvars.iv.next.i8, %wide.trip.count.i.i
br i1 %exitcond.not.i9, label %insertion_sort.exit, label %for.body.us.i, !llvm.loop !12
insertion_sort.exit: ; preds = %dump_arr.exit.loopexit.us.i, %entry, %for.end, %dump_arr.exit
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %arr) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
void insertionSort(int targetArray[], int size)
{
for (int i = 1; i < size; i++)
{
int currentNumber = targetArray[i];
int j = i - 1;
int foreNumber = targetArray[j];
while (j >= 0 && targetArray[j] > currentNumber)
{
targetArray[j + 1] = targetArray[j];
j--;
targetArray[j + 1] = currentNumber;
}
for (int j = 0; j < size; ++j)
{
if (j == 0)
printf("%d", targetArray[j]);
else
printf(" %d", targetArray[j]);
}
putchar('\n');
}
}
int main()
{
int size;
scanf("%d", &size);
int targetArray[size];
for (int i = 0; i < size; i++)
{
scanf("%d", &targetArray[i]);
}
for (int j = 0; j < size; ++j)
{
if (j == 0)
printf("%d", targetArray[j]);
else
printf(" %d", targetArray[j]);
}
putchar('\n');
insertionSort(targetArray, size);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116298/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116298/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %targetArray, i32 noundef %size) local_unnamed_addr #0 {
entry:
%cmp57 = icmp sgt i32 %size, 1
br i1 %cmp57, label %for.body.us.preheader, label %for.cond.cleanup
for.body.us.preheader: ; preds = %entry
%wide.trip.count70 = zext i32 %size to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond15.for.cond.cleanup17_crit_edge.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %for.cond15.for.cond.cleanup17_crit_edge.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %targetArray, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv60 = phi i64 [ %indvars.iv.next61, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next61 = add nsw i64 %indvars.iv60, -1
%idxprom4.us = and i64 %indvars.iv.next61, 4294967295
%arrayidx5.us = getelementptr inbounds i32, ptr %targetArray, i64 %idxprom4.us
%1 = load i32, ptr %arrayidx5.us, align 4, !tbaa !5
%cmp6.us = icmp sgt i32 %1, %0
br i1 %cmp6.us, label %while.body.us, label %for.inc.us.peel
for.inc.us.peel: ; preds = %while.body.us, %land.rhs.us
%2 = load i32, ptr %targetArray, align 4, !tbaa !5
%call.us.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
br label %for.inc.us
for.inc.us: ; preds = %for.inc.us.peel, %for.inc.us
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.inc.us ], [ 1, %for.inc.us.peel ]
%arrayidx23.us = getelementptr inbounds i32, ptr %targetArray, i64 %indvars.iv63
%3 = load i32, ptr %arrayidx23.us, align 4, !tbaa !5
%call24.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%exitcond.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count70
br i1 %exitcond.not, label %for.cond15.for.cond.cleanup17_crit_edge.us, label %for.inc.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx10.us = getelementptr inbounds i32, ptr %targetArray, i64 %indvars.iv60
store i32 %1, ptr %arrayidx10.us, align 4, !tbaa !5
store i32 %0, ptr %arrayidx5.us, align 4, !tbaa !5
%4 = icmp sgt i64 %indvars.iv60, 1
br i1 %4, label %land.rhs.us, label %for.inc.us.peel, !llvm.loop !12
for.cond15.for.cond.cleanup17_crit_edge.us: ; preds = %for.inc.us
%5 = load ptr, ptr @stdout, align 8, !tbaa !13
%call.i.us = tail call i32 @putc(i32 noundef 10, ptr noundef %5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond71.not = icmp eq i64 %indvars.iv.next, %wide.trip.count70
br i1 %exitcond71.not, label %for.cond.cleanup, label %for.body.us, !llvm.loop !15
for.cond.cleanup: ; preds = %for.cond15.for.cond.cleanup17_crit_edge.us, %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: 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:
%size = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %size) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %size)
%0 = load i32, ptr %size, 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 %size, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %3, 0
br i1 %cmp23, label %for.body, label %for.cond.cleanup4
for.cond2.preheader: ; preds = %for.body
%4 = icmp sgt i32 %6, 0
br i1 %4, label %for.inc13.peel, label %for.cond.cleanup4
for.inc13.peel: ; preds = %for.cond2.preheader
%5 = load i32, ptr %vla, align 16, !tbaa !5
%call9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%.pre = load i32, ptr %size, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %.pre, 1
br i1 %cmp3.peel, label %for.inc13, label %for.cond.cleanup4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %size, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !16
for.cond.cleanup4: ; preds = %for.inc13, %entry, %for.inc13.peel, %for.cond2.preheader
%8 = load ptr, ptr @stdout, align 8, !tbaa !13
%call.i = call i32 @putc(i32 noundef 10, ptr noundef %8)
%9 = load i32, ptr %size, align 4, !tbaa !5
%cmp57.i = icmp sgt i32 %9, 1
br i1 %cmp57.i, label %for.body.us.preheader.i, label %insertionSort.exit
for.body.us.preheader.i: ; preds = %for.cond.cleanup4
%wide.trip.count70.i = zext i32 %9 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond15.for.cond.cleanup17_crit_edge.us.i, %for.body.us.preheader.i
%indvars.iv.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i, %for.cond15.for.cond.cleanup17_crit_edge.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i
%10 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv60.i = phi i64 [ %indvars.iv.next61.i, %while.body.us.i ], [ %indvars.iv.i, %for.body.us.i ]
%indvars.iv.next61.i = add nsw i64 %indvars.iv60.i, -1
%idxprom4.us.i = and i64 %indvars.iv.next61.i, 4294967295
%arrayidx5.us.i = getelementptr inbounds i32, ptr %vla, i64 %idxprom4.us.i
%11 = load i32, ptr %arrayidx5.us.i, align 4, !tbaa !5
%cmp6.us.i = icmp sgt i32 %11, %10
br i1 %cmp6.us.i, label %while.body.us.i, label %for.inc.us.peel.i
for.inc.us.peel.i: ; preds = %while.body.us.i, %land.rhs.us.i
%12 = load i32, ptr %vla, align 16, !tbaa !5
%call.us.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %12)
br label %for.inc.us.i
for.inc.us.i: ; preds = %for.inc.us.i, %for.inc.us.peel.i
%indvars.iv63.i = phi i64 [ %indvars.iv.next64.i, %for.inc.us.i ], [ 1, %for.inc.us.peel.i ]
%arrayidx23.us.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv63.i
%13 = load i32, ptr %arrayidx23.us.i, align 4, !tbaa !5
%call24.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
%indvars.iv.next64.i = add nuw nsw i64 %indvars.iv63.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next64.i, %wide.trip.count70.i
br i1 %exitcond.not.i, label %for.cond15.for.cond.cleanup17_crit_edge.us.i, label %for.inc.us.i, !llvm.loop !9
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx10.us.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv60.i
store i32 %11, ptr %arrayidx10.us.i, align 4, !tbaa !5
store i32 %10, ptr %arrayidx5.us.i, align 4, !tbaa !5
%14 = icmp sgt i64 %indvars.iv60.i, 1
br i1 %14, label %land.rhs.us.i, label %for.inc.us.peel.i, !llvm.loop !12
for.cond15.for.cond.cleanup17_crit_edge.us.i: ; preds = %for.inc.us.i
%15 = load ptr, ptr @stdout, align 8, !tbaa !13
%call.i.us.i = call i32 @putc(i32 noundef 10, ptr noundef %15)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond71.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count70.i
br i1 %exitcond71.not.i, label %insertionSort.exit, label %for.body.us.i, !llvm.loop !15
insertionSort.exit: ; preds = %for.cond15.for.cond.cleanup17_crit_edge.us.i, %for.cond.cleanup4
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %size) #4
ret i32 0
for.inc13: ; preds = %for.inc13.peel, %for.inc13
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.inc13 ], [ 1, %for.inc13.peel ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv28
%16 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %16)
%.pre32 = load i32, ptr %size, align 4, !tbaa !5
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%17 = sext i32 %.pre32 to i64
%cmp3 = icmp slt i64 %indvars.iv.next29, %17
br i1 %cmp3, label %for.inc13, label %for.cond.cleanup4, !llvm.loop !17
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, 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 nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !11}
|
#include<stdio.h>
int main(){
int N,A[1000],v;
int i,j;
scanf("%d",&N);
for(i=0;i<=N-1;i++)scanf("%d",&A[i]);
for(i=0;i<N-1;i++)printf("%d ",A[i]);
printf("%d\n",A[N-1]);
for(i=1;i<=N-1;i++){
v=A[i];
j=i-1;
while(j>=0&&A[j]>v){
A[j+1]=A[j];
j--;
}
A[j+1]=v;
for(j=0;j<N-1;j++)printf("%d ",A[j]);
printf("%d\n",A[N-1]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116340/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116340/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not.not69 = icmp sgt i32 %0, 0
br i1 %cmp.not.not69, label %for.body, label %for.cond2.preheader.for.end11_crit_edge
for.cond2.preheader: ; preds = %for.body
%cmp472 = icmp sgt i32 %2, 1
br i1 %cmp472, label %for.body5, label %for.cond2.preheader.for.end11_crit_edge
for.cond2.preheader.for.end11_crit_edge: ; preds = %entry, %for.cond2.preheader
%1 = phi i32 [ %2, %for.cond2.preheader ], [ %0, %entry ]
%sub371 = add nsw i32 %1, -1
%.pre = sext i32 %sub371 to i64
br label %for.end11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp.not.not = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body5: ; preds = %for.cond2.preheader, %for.body5
%indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.body5 ], [ 0, %for.cond2.preheader ]
%arrayidx7 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv86
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%sub3 = add nsw i32 %5, -1
%6 = sext i32 %sub3 to i64
%cmp4 = icmp slt i64 %indvars.iv.next87, %6
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !11
for.end11: ; preds = %for.body5, %for.cond2.preheader.for.end11_crit_edge
%idxprom13.pre-phi = phi i64 [ %.pre, %for.cond2.preheader.for.end11_crit_edge ], [ %6, %for.body5 ]
%arrayidx14 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom13.pre-phi
%7 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%8 = load i32, ptr %N, align 4, !tbaa !5
%cmp18.not.not81 = icmp sgt i32 %8, 1
br i1 %cmp18.not.not81, label %for.body19, label %for.end50
for.body19: ; preds = %for.end11, %for.end43
%9 = phi i32 [ %17, %for.end43 ], [ %8, %for.end11 ]
%indvars.iv89 = phi i64 [ %indvars.iv.next90, %for.end43 ], [ 1, %for.end11 ]
%arrayidx21 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv89
%10 = load i32, ptr %arrayidx21, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body19, %while.body
%indvars.iv91 = phi i64 [ %indvars.iv89, %for.body19 ], [ %indvars.iv.next92, %while.body ]
%indvars.iv.next92 = add nsw i64 %indvars.iv91, -1
%idxprom24 = and i64 %indvars.iv.next92, 4294967295
%arrayidx25 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom24
%11 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %11, %10
br i1 %cmp26, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx30 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv91
store i32 %11, ptr %arrayidx30, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv91, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv91, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom32 = ashr exact i64 %sext, 32
%arrayidx33 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom32
store i32 %10, ptr %arrayidx33, align 4, !tbaa !5
%cmp3678 = icmp sgt i32 %9, 1
br i1 %cmp3678, label %for.body37, label %while.end.for.end43_crit_edge
while.end.for.end43_crit_edge: ; preds = %while.end
%sub3577 = add nsw i32 %9, -1
%.pre100 = sext i32 %sub3577 to i64
br label %for.end43
for.body37: ; preds = %while.end, %for.body37
%indvars.iv94 = phi i64 [ %indvars.iv.next95, %for.body37 ], [ 0, %while.end ]
%arrayidx39 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv94
%13 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
%14 = load i32, ptr %N, align 4, !tbaa !5
%sub35 = add nsw i32 %14, -1
%15 = sext i32 %sub35 to i64
%cmp36 = icmp slt i64 %indvars.iv.next95, %15
br i1 %cmp36, label %for.body37, label %for.end43, !llvm.loop !13
for.end43: ; preds = %for.body37, %while.end.for.end43_crit_edge
%idxprom45.pre-phi = phi i64 [ %.pre100, %while.end.for.end43_crit_edge ], [ %15, %for.body37 ]
%arrayidx46 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom45.pre-phi
%16 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%17 = load i32, ptr %N, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp18.not.not = icmp slt i64 %indvars.iv.next90, %18
br i1 %cmp18.not.not, label %for.body19, label %for.end50, !llvm.loop !14
for.end50: ; preds = %for.end43, %for.end11
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main(){
int aaa[100],gyo,i,j,temp;
scanf("%d",&gyo);
for(i=0;i<gyo;i++){
scanf("%d",&aaa[i]);
}
for(i=0;i<gyo;i++){
for(j=i;0<j;j--){
if(aaa[j-1]>aaa[j]){
temp=aaa[j];
aaa[j]=aaa[j-1];
aaa[j-1]=temp;
}
else break;
}
for(j=0;j<gyo-1;j++){
printf("%d ",aaa[j]);
}
printf("%d\n",aaa[gyo-1]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116384/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116384/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%aaa = alloca [100 x i32], align 16
%gyo = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %aaa) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %gyo) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %gyo)
%0 = load i32, ptr %gyo, align 4, !tbaa !5
%cmp58 = icmp sgt i32 %0, 0
br i1 %cmp58, label %for.body, label %for.end41
for.cond2.preheader: ; preds = %for.body
%cmp365 = icmp sgt i32 %1, 0
br i1 %cmp365, label %for.cond5.preheader, label %for.end41
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %aaa, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %gyo, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond2.preheader, %for.end34
%3 = phi i32 [ %9, %for.end34 ], [ %1, %for.cond2.preheader ]
%i.166 = phi i32 [ %inc40, %for.end34 ], [ 0, %for.cond2.preheader ]
%cmp660.not = icmp eq i32 %i.166, 0
br i1 %cmp660.not, label %for.end24, label %for.body7.preheader
for.body7.preheader: ; preds = %for.cond5.preheader
%idxprom10.phi.trans.insert = zext i32 %i.166 to i64
%arrayidx11.phi.trans.insert = getelementptr inbounds [100 x i32], ptr %aaa, i64 0, i64 %idxprom10.phi.trans.insert
%.pre = load i32, ptr %arrayidx11.phi.trans.insert, align 4, !tbaa !5
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %if.then
%j.061 = phi i32 [ %sub, %if.then ], [ %i.166, %for.body7.preheader ]
%sub = add nsw i32 %j.061, -1
%idxprom8 = zext i32 %sub to i64
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %aaa, i64 0, i64 %idxprom8
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %4, %.pre
br i1 %cmp12, label %if.then, label %for.end24
if.then: ; preds = %for.body7
%idxprom10 = zext i32 %j.061 to i64
%arrayidx11 = getelementptr inbounds [100 x i32], ptr %aaa, i64 0, i64 %idxprom10
store i32 %4, ptr %arrayidx11, align 4, !tbaa !5
store i32 %.pre, ptr %arrayidx9, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %j.061, 1
br i1 %cmp6, label %for.body7, label %for.end24, !llvm.loop !11
for.end24: ; preds = %if.then, %for.body7, %for.cond5.preheader
%cmp2763 = icmp sgt i32 %3, 1
br i1 %cmp2763, label %for.body28, label %for.end24.for.end34_crit_edge
for.end24.for.end34_crit_edge: ; preds = %for.end24
%sub2662 = add nsw i32 %3, -1
%.pre72 = sext i32 %sub2662 to i64
br label %for.end34
for.body28: ; preds = %for.end24, %for.body28
%indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.body28 ], [ 0, %for.end24 ]
%arrayidx30 = getelementptr inbounds [100 x i32], ptr %aaa, i64 0, i64 %indvars.iv69
%5 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%6 = load i32, ptr %gyo, align 4, !tbaa !5
%sub26 = add nsw i32 %6, -1
%7 = sext i32 %sub26 to i64
%cmp27 = icmp slt i64 %indvars.iv.next70, %7
br i1 %cmp27, label %for.body28, label %for.end34, !llvm.loop !12
for.end34: ; preds = %for.body28, %for.end24.for.end34_crit_edge
%idxprom36.pre-phi = phi i64 [ %.pre72, %for.end24.for.end34_crit_edge ], [ %7, %for.body28 ]
%arrayidx37 = getelementptr inbounds [100 x i32], ptr %aaa, i64 0, i64 %idxprom36.pre-phi
%8 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%inc40 = add nuw nsw i32 %i.166, 1
%9 = load i32, ptr %gyo, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc40, %9
br i1 %cmp3, label %for.cond5.preheader, label %for.end41, !llvm.loop !13
for.end41: ; preds = %for.end34, %entry, %for.cond2.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %gyo) #3
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %aaa) #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}
|
#include <stdio.h>
#define N 100
int main(){
int i,j,b,v,k;
int a[N];
scanf("%d", &b);
for(i = 0; i <= b-1; i++){
scanf("%d", &a[i]);
}
printf("%d", a[0]);
for(k = 1; k <= b-1; k++){
printf(" %d", a[k]);
}
printf("\n");
for(i = 1; i <= b-1; i++){
v = a[i];
j = i - 1;
while(j >= 0 && a[j] > v){
a[j+1] = a[j];
j--;
}
a[j+1] = v;
printf("%d", a[0]);
for(k = 1; k <= b-1; k++){
printf(" %d", a[k]);
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116427/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116427/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%b = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i32, ptr %b, align 4, !tbaa !5
%cmp.not.not67 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp.not.not67)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp.not.not, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%.pre = load i32, ptr %a, align 16, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%3 = load i32, ptr %b, align 4, !tbaa !5
%cmp6.not.not69 = icmp sgt i32 %3, 1
br i1 %cmp6.not.not69, label %for.body7, label %for.end13
for.body7: ; preds = %for.end.loopexit, %for.body7
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.body7 ], [ 1, %for.end.loopexit ]
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv79
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%5 = load i32, ptr %b, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp6.not.not = icmp slt i64 %indvars.iv.next80, %6
br i1 %cmp6.not.not, label %for.body7, label %for.end13, !llvm.loop !11
for.end13: ; preds = %for.body7, %for.end.loopexit
%putchar = call i32 @putchar(i32 10)
%7 = load i32, ptr %b, align 4, !tbaa !5
%cmp17.not.not76 = icmp sgt i32 %7, 1
br i1 %cmp17.not.not76, label %for.body18, label %for.end48
for.body18: ; preds = %for.end13, %for.end44
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %for.end44 ], [ 1, %for.end13 ]
%arrayidx20 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv82
%8 = load i32, ptr %arrayidx20, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body18, %while.body
%indvars.iv84 = phi i64 [ %indvars.iv82, %for.body18 ], [ %indvars.iv.next85, %while.body ]
%indvars.iv.next85 = add nsw i64 %indvars.iv84, -1
%idxprom23 = and i64 %indvars.iv.next85, 4294967295
%arrayidx24 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom23
%9 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %9, %8
br i1 %cmp25, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx29 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv84
store i32 %9, ptr %arrayidx29, align 4, !tbaa !5
%10 = icmp sgt i64 %indvars.iv84, 1
br i1 %10, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv84, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom31 = ashr exact i64 %sext, 32
%arrayidx32 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom31
store i32 %8, ptr %arrayidx32, align 4, !tbaa !5
%11 = load i32, ptr %a, align 16, !tbaa !5
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11)
%12 = load i32, ptr %b, align 4, !tbaa !5
%cmp37.not.not74 = icmp sgt i32 %12, 1
br i1 %cmp37.not.not74, label %for.body38, label %for.end44
for.body38: ; preds = %while.end, %for.body38
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.body38 ], [ 1, %while.end ]
%arrayidx40 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv87
%13 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%14 = load i32, ptr %b, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp37.not.not = icmp slt i64 %indvars.iv.next88, %15
br i1 %cmp37.not.not, label %for.body38, label %for.end44, !llvm.loop !13
for.end44: ; preds = %for.body38, %while.end
%putchar66 = call i32 @putchar(i32 10)
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%16 = load i32, ptr %b, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp17.not.not = icmp slt i64 %indvars.iv.next83, %17
br i1 %cmp17.not.not, label %for.body18, label %for.end48, !llvm.loop !14
for.end48: ; preds = %for.end44, %for.end13
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#define N 100
int main(){
int A[N],v,i,j,n,a=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
for(a=0;a<n;a++){
printf("%d",A[a]);
if(a!=n-1)
printf(" ");
}
printf("\n");
for(i=1;i<n;i++){
v=A[i];
j=i-1;
while(j>=0&&A[j]>v){
A[j+1]=A[j];
j--;
}
A[j+1]=v;
for(a=0;a<n;a++){
printf("%d",A[a]);
if(a!=n-1)
printf(" ");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116470/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116470/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [100 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %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
%cmp71 = icmp sgt i32 %0, 0
br i1 %cmp71, label %for.body, label %for.end12
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, label %for.end12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.inc10
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.inc10 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv83
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = zext i32 %sub to i64
%cmp8.not = icmp eq i64 %indvars.iv83, %6
br i1 %cmp8.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body4
%putchar70 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next84, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.inc10, %entry, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp1580 = icmp sgt i32 %9, 1
br i1 %cmp1580, label %for.body16, label %for.end48
for.body16: ; preds = %for.end12, %for.end44
%10 = phi i32 [ %19, %for.end44 ], [ %9, %for.end12 ]
%indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.end44 ], [ 1, %for.end12 ]
%arrayidx18 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv86
%11 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body16, %while.body
%indvars.iv88 = phi i64 [ %indvars.iv86, %for.body16 ], [ %indvars.iv.next89, %while.body ]
%indvars.iv.next89 = add nsw i64 %indvars.iv88, -1
%idxprom21 = and i64 %indvars.iv.next89, 4294967295
%arrayidx22 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom21
%12 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %12, %11
br i1 %cmp23, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx27 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv88
store i32 %12, ptr %arrayidx27, align 4, !tbaa !5
%13 = icmp sgt i64 %indvars.iv88, 1
br i1 %13, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv88, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom29 = ashr exact i64 %sext, 32
%arrayidx30 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom29
store i32 %11, ptr %arrayidx30, align 4, !tbaa !5
%cmp3278 = icmp sgt i32 %10, 0
br i1 %cmp3278, label %for.body33, label %for.end44
for.body33: ; preds = %while.end, %for.inc42
%indvars.iv91 = phi i64 [ %indvars.iv.next92, %for.inc42 ], [ 0, %while.end ]
%arrayidx35 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv91
%14 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %14)
%15 = load i32, ptr %n, align 4, !tbaa !5
%sub37 = add nsw i32 %15, -1
%16 = zext i32 %sub37 to i64
%cmp38.not = icmp eq i64 %indvars.iv91, %16
br i1 %cmp38.not, label %for.inc42, label %if.then39
if.then39: ; preds = %for.body33
%putchar69 = call i32 @putchar(i32 32)
%.pre97 = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc42
for.inc42: ; preds = %for.body33, %if.then39
%17 = phi i32 [ %15, %for.body33 ], [ %.pre97, %if.then39 ]
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%18 = sext i32 %17 to i64
%cmp32 = icmp slt i64 %indvars.iv.next92, %18
br i1 %cmp32, label %for.body33, label %for.end44, !llvm.loop !13
for.end44: ; preds = %for.inc42, %while.end
%putchar68 = call i32 @putchar(i32 10)
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp15 = icmp slt i64 %indvars.iv.next87, %20
br i1 %cmp15, label %for.body16, label %for.end48, !llvm.loop !14
for.end48: ; preds = %for.end44, %for.end12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
void insertionsort(int A[], int N);
int main(void)
{
int N;
scanf("%d", &N);
int A[N];
for(int i=0; i<N; i++)
{
scanf("%d", &A[i]);
}
for(int l=0; l<N; l++)
{
if(l>0)
{
printf(" ");
}
printf("%d", A[l]);
}
printf("\n");
insertionsort(A, N);
}
void insertionsort(int A[], int N)
{
int j, record;
for(int i=1; i<N; i++)
{
record = A[i];
j = i-1;
while(j>=0 && A[j] > record)
{
A[j+1] = A[j];
j--;
}
A[j+1] = record;
for(int k=0; k<N; k++)
{
if( k > 0)
{
printf(" ");
}
printf("%d", A[k]);
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116513/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116513/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %3, 0
br i1 %cmp21, label %for.body, label %for.cond.cleanup4
for.cond2.preheader: ; preds = %for.body
%4 = icmp sgt i32 %6, 0
br i1 %4, label %if.end.peel, label %for.cond.cleanup4
if.end.peel: ; preds = %for.cond2.preheader
%.pre = load i32, ptr %vla, align 16, !tbaa !5
%call10.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%5 = load i32, ptr %N, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %5, 1
br i1 %cmp3.peel, label %if.end, label %for.cond.cleanup4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %N, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond.cleanup4: ; preds = %if.end, %entry, %if.end.peel, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr %N, align 4, !tbaa !5
%cmp48.i = icmp sgt i32 %8, 1
br i1 %cmp48.i, label %for.body.us.preheader.i, label %insertionsort.exit
for.body.us.preheader.i: ; preds = %for.cond.cleanup4
%wide.trip.count61.i = zext i32 %8 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond12.for.cond.cleanup14_crit_edge.us.i, %for.body.us.preheader.i
%indvars.iv.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i, %for.cond12.for.cond.cleanup14_crit_edge.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i
%9 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv51.i = phi i64 [ %indvars.iv.next52.i, %while.body.us.i ], [ %indvars.iv.i, %for.body.us.i ]
%indvars.iv.next52.i = add nsw i64 %indvars.iv51.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next52.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr %vla, i64 %idxprom2.us.i
%10 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp sgt i32 %10, %9
br i1 %cmp4.us.i, label %while.body.us.i, label %if.end.us.peel.i
if.end.us.peel.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv51.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom10.us.i = ashr exact i64 %sext.i, 32
%arrayidx11.us.i = getelementptr inbounds i32, ptr %vla, i64 %idxprom10.us.i
store i32 %9, ptr %arrayidx11.us.i, align 4, !tbaa !5
%.pre.i = load i32, ptr %vla, align 16, !tbaa !5
%call19.us.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre.i)
br label %if.end.us.i
if.end.us.i: ; preds = %if.end.us.i, %if.end.us.peel.i
%indvars.iv54.i = phi i64 [ %indvars.iv.next55.i, %if.end.us.i ], [ 1, %if.end.us.peel.i ]
%putchar42.us.i = call i32 @putchar(i32 32)
%arrayidx18.us.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv54.i
%11 = load i32, ptr %arrayidx18.us.i, align 4, !tbaa !5
%call19.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11)
%indvars.iv.next55.i = add nuw nsw i64 %indvars.iv54.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next55.i, %wide.trip.count61.i
br i1 %exitcond.not.i, label %for.cond12.for.cond.cleanup14_crit_edge.us.i, label %if.end.us.i, !llvm.loop !11
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv51.i
store i32 %10, ptr %arrayidx8.us.i, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv51.i, 1
br i1 %12, label %land.rhs.us.i, label %if.end.us.peel.i, !llvm.loop !13
for.cond12.for.cond.cleanup14_crit_edge.us.i: ; preds = %if.end.us.i
%putchar.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond62.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count61.i
br i1 %exitcond62.not.i, label %insertionsort.exit, label %for.body.us.i, !llvm.loop !14
insertionsort.exit: ; preds = %for.cond12.for.cond.cleanup14_crit_edge.us.i, %for.cond.cleanup4
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %if.end ], [ 1, %if.end.peel ]
%putchar20 = call i32 @putchar(i32 32)
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv26
%13 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%14 = load i32, ptr %N, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %15
br i1 %cmp3, label %if.end, label %for.cond.cleanup4, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
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: nofree nounwind uwtable
define dso_local void @insertionsort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp48 = icmp sgt i32 %N, 1
br i1 %cmp48, label %for.body.us.preheader, label %for.cond.cleanup
for.body.us.preheader: ; preds = %entry
%wide.trip.count61 = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond12.for.cond.cleanup14_crit_edge.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %for.cond12.for.cond.cleanup14_crit_edge.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next52 = add nsw i64 %indvars.iv51, -1
%idxprom2.us = and i64 %indvars.iv.next52, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us
%1 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp sgt i32 %1, %0
br i1 %cmp4.us, label %while.body.us, label %if.end.us.peel
if.end.us.peel: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv51, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom10.us = ashr exact i64 %sext, 32
%arrayidx11.us = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us
store i32 %0, ptr %arrayidx11.us, align 4, !tbaa !5
%.pre = load i32, ptr %A, align 4, !tbaa !5
%call19.us.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
br label %if.end.us
if.end.us: ; preds = %if.end.us.peel, %if.end.us
%indvars.iv54 = phi i64 [ %indvars.iv.next55, %if.end.us ], [ 1, %if.end.us.peel ]
%putchar42.us = tail call i32 @putchar(i32 32)
%arrayidx18.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv54
%2 = load i32, ptr %arrayidx18.us, align 4, !tbaa !5
%call19.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count61
br i1 %exitcond.not, label %for.cond12.for.cond.cleanup14_crit_edge.us, label %if.end.us, !llvm.loop !11
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %A, i64 %indvars.iv51
store i32 %1, ptr %arrayidx8.us, align 4, !tbaa !5
%3 = icmp sgt i64 %indvars.iv51, 1
br i1 %3, label %land.rhs.us, label %if.end.us.peel, !llvm.loop !13
for.cond12.for.cond.cleanup14_crit_edge.us: ; preds = %if.end.us
%putchar.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond62.not = icmp eq i64 %indvars.iv.next, %wide.trip.count61
br i1 %exitcond62.not, label %for.cond.cleanup, label %for.body.us, !llvm.loop !14
for.cond.cleanup: ; preds = %for.cond12.for.cond.cleanup14_crit_edge.us, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !12}
|
#include<stdio.h>
int main(void){
int N,i,j,k,a=0;
scanf("%d",&N);
int sort[N];
for(i=0;i<N;i++)
{
scanf("%d",&sort[i]);
}
for(i=0;i<N;i++)
{
for(j=i;j>=0;j--)
{
if(sort[j-1]>sort[j])
{
a=sort[j-1];
sort[j-1]=sort[j];
sort[j]=a;
}
}
for(k=0;k<N-1;k++)
{
printf("%d ",sort[k]);
}
printf("%d",sort[N-1]);
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116564/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116564/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp58 = icmp sgt i32 %3, 0
br i1 %cmp58, label %for.body, label %for.end42
for.cond2.preheader: ; preds = %for.body
%cmp365 = icmp sgt i32 %4, 0
br i1 %cmp365, label %for.body7.preheader, label %for.end42
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body7.preheader: ; preds = %for.cond2.preheader, %for.end34
%6 = phi i32 [ %19, %for.end34 ], [ %4, %for.cond2.preheader ]
%indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.end34 ], [ 0, %for.cond2.preheader ]
%7 = and i64 %indvars.iv69, 1
%lcmp.mod.not.not = icmp eq i64 %7, 0
br i1 %lcmp.mod.not.not, label %for.body7.prol, label %for.body7.prol.loopexit
for.body7.prol: ; preds = %for.body7.preheader
%indvars.iv.next72.prol = add nsw i64 %indvars.iv69, -1
%arrayidx9.prol = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next72.prol
%8 = load i32, ptr %arrayidx9.prol, align 4, !tbaa !5
%idxprom10.prol = and i64 %indvars.iv69, 4294967295
%arrayidx11.prol = getelementptr inbounds i32, ptr %vla, i64 %idxprom10.prol
%9 = load i32, ptr %arrayidx11.prol, align 4, !tbaa !5
%cmp12.prol = icmp sgt i32 %8, %9
br i1 %cmp12.prol, label %if.then.prol, label %for.body7.prol.loopexit
if.then.prol: ; preds = %for.body7.prol
store i32 %9, ptr %arrayidx9.prol, align 4, !tbaa !5
store i32 %8, ptr %arrayidx11.prol, align 4, !tbaa !5
br label %for.body7.prol.loopexit
for.body7.prol.loopexit: ; preds = %for.body7.prol, %if.then.prol, %for.body7.preheader
%indvars.iv71.unr = phi i64 [ %indvars.iv69, %for.body7.preheader ], [ %indvars.iv.next72.prol, %if.then.prol ], [ %indvars.iv.next72.prol, %for.body7.prol ]
%10 = icmp eq i64 %indvars.iv69, 0
br i1 %10, label %for.cond25.preheader, label %for.body7
for.cond25.preheader: ; preds = %for.inc23.1, %for.body7.prol.loopexit
%cmp2763 = icmp sgt i32 %6, 1
br i1 %cmp2763, label %for.body28, label %for.cond25.preheader.for.end34_crit_edge
for.cond25.preheader.for.end34_crit_edge: ; preds = %for.cond25.preheader
%sub2662 = add nsw i32 %6, -1
%.pre = sext i32 %sub2662 to i64
br label %for.end34
for.body7: ; preds = %for.body7.prol.loopexit, %for.inc23.1
%indvars.iv71 = phi i64 [ %indvars.iv.next72.1, %for.inc23.1 ], [ %indvars.iv71.unr, %for.body7.prol.loopexit ]
%indvars.iv.next72 = add nsw i64 %indvars.iv71, -1
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next72
%11 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%idxprom10 = and i64 %indvars.iv71, 4294967295
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %idxprom10
%12 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %11, %12
br i1 %cmp12, label %if.then, label %for.inc23
if.then: ; preds = %for.body7
store i32 %12, ptr %arrayidx9, align 4, !tbaa !5
store i32 %11, ptr %arrayidx11, align 4, !tbaa !5
br label %for.inc23
for.inc23: ; preds = %for.body7, %if.then
%indvars.iv.next72.1 = add nsw i64 %indvars.iv71, -2
%arrayidx9.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next72.1
%13 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
%idxprom10.1 = and i64 %indvars.iv.next72, 4294967295
%arrayidx11.1 = getelementptr inbounds i32, ptr %vla, i64 %idxprom10.1
%14 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%cmp12.1 = icmp sgt i32 %13, %14
br i1 %cmp12.1, label %if.then.1, label %for.inc23.1
if.then.1: ; preds = %for.inc23
store i32 %14, ptr %arrayidx9.1, align 4, !tbaa !5
store i32 %13, ptr %arrayidx11.1, align 4, !tbaa !5
br label %for.inc23.1
for.inc23.1: ; preds = %if.then.1, %for.inc23
%cmp6.1 = icmp sgt i64 %indvars.iv71, 1
br i1 %cmp6.1, label %for.body7, label %for.cond25.preheader, !llvm.loop !11
for.body28: ; preds = %for.cond25.preheader, %for.body28
%indvars.iv74 = phi i64 [ %indvars.iv.next75, %for.body28 ], [ 0, %for.cond25.preheader ]
%arrayidx30 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv74
%15 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %15)
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%16 = load i32, ptr %N, align 4, !tbaa !5
%sub26 = add nsw i32 %16, -1
%17 = sext i32 %sub26 to i64
%cmp27 = icmp slt i64 %indvars.iv.next75, %17
br i1 %cmp27, label %for.body28, label %for.end34, !llvm.loop !12
for.end34: ; preds = %for.body28, %for.cond25.preheader.for.end34_crit_edge
%idxprom36.pre-phi = phi i64 [ %.pre, %for.cond25.preheader.for.end34_crit_edge ], [ %17, %for.body28 ]
%arrayidx37 = getelementptr inbounds i32, ptr %vla, i64 %idxprom36.pre-phi
%18 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %18)
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%indvars = trunc i64 %indvars.iv.next70 to i32
%19 = load i32, ptr %N, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %19, %indvars
br i1 %cmp3, label %for.body7.preheader, label %for.end42, !llvm.loop !13
for.end42: ; preds = %for.end34, %entry, %for.cond2.preheader
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(){
int n,i,j,k;
scanf("%d",&n);
int a[100];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(i<n-1)printf("%d ",a[i]);
}
printf("%d\n",a[i-1]);
for(i=1;i<n;i++){
int v=a[i];
j=i-1;
while(j>=0&&a[j]>v){
a[j+1]=a[j];
j--;
}
a[j+1]=v;
for(k=0;k<n-1;k++){
printf("%d ",a[k]);
}
printf("%d\n",a[k]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116607/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116607/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100 x i32], align 16
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)
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp61 = icmp sgt i32 %0, 0
br i1 %cmp61, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%2 = sext i32 %sub to i64
%cmp2 = icmp slt i64 %indvars.iv, %2
br i1 %cmp2, label %if.then, label %for.inc
if.then: ; preds = %for.body
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%4 = phi i32 [ %1, %for.body ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%sext = shl i64 %indvars.iv, 32
%6 = ashr exact i64 %sext, 32
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%i.0.lcssa = phi i64 [ -1, %entry ], [ %6, %for.end.loopexit ]
%arrayidx8 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %i.0.lcssa
%7 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp1170 = icmp sgt i32 %8, 1
br i1 %cmp1170, label %for.body12, label %for.end42
for.body12: ; preds = %for.end, %for.end36
%9 = phi i32 [ %17, %for.end36 ], [ %8, %for.end ]
%indvars.iv73 = phi i64 [ %indvars.iv.next74, %for.end36 ], [ 1, %for.end ]
%arrayidx14 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv73
%10 = load i32, ptr %arrayidx14, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body12, %while.body
%indvars.iv75 = phi i64 [ %indvars.iv73, %for.body12 ], [ %indvars.iv.next76, %while.body ]
%indvars.iv.next76 = add nsw i64 %indvars.iv75, -1
%idxprom17 = and i64 %indvars.iv.next76, 4294967295
%arrayidx18 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom17
%11 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %11, %10
br i1 %cmp19, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx23 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv75
store i32 %11, ptr %arrayidx23, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv75, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv75, %land.rhs ]
%sext84 = shl i64 %j.0.in.lcssa, 32
%idxprom25 = ashr exact i64 %sext84, 32
%arrayidx26 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom25
store i32 %10, ptr %arrayidx26, align 4, !tbaa !5
%cmp2967 = icmp sgt i32 %9, 1
br i1 %cmp2967, label %for.body30, label %for.end36
for.body30: ; preds = %while.end, %for.body30
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body30 ], [ 0, %while.end ]
%arrayidx32 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv78
%13 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%sub28 = add nsw i32 %14, -1
%15 = sext i32 %sub28 to i64
%cmp29 = icmp slt i64 %indvars.iv.next79, %15
br i1 %cmp29, label %for.body30, label %for.end36, !llvm.loop !12
for.end36: ; preds = %for.body30, %while.end
%k.0.lcssa = phi i64 [ 0, %while.end ], [ %indvars.iv.next79, %for.body30 ]
%idxprom37 = and i64 %k.0.lcssa, 4294967295
%arrayidx38 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom37
%16 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp11 = icmp slt i64 %indvars.iv.next74, %18
br i1 %cmp11, label %for.body12, label %for.end42, !llvm.loop !13
for.end42: ; preds = %for.end36, %for.end
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <string.h>
void process(int *x, int z){
for(int k = 0; k < z; k++){
printf("%d", x[k]);
if(k < z - 1){
printf(" ");
}else{
printf("\n");
}
}
}
void insertionSort(int *x, int y){
int i, v, j;
for(i = 1; i < y; i++){
v = x[i];
j = i -1;
while(j >= 0 && x[j] > v){
x[j + 1] = x[j];
j--;
}
x[j + 1] = v;
process(x, y);
}
}
int main(void){
int n;
int hand[101];
char *number;
char order[1000000];
fgets(order, 300, stdin);
sscanf(order, "%d", &n);
fgets(order, 1000000, stdin);
number = strtok(order, " \n"); //要素が一個だけだったら数字の次は改行コードが入るので改行コードも入れる。
sscanf(number, "%d", &hand[0]);
for(int j = 1; j < n; j++){
number = strtok(NULL, " \n");
sscanf(number, "%d", &hand[j]);
}
process(hand, n);
insertionSort(hand, n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116650/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116650/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.3 = private unnamed_addr constant [3 x i8] c" \0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @process(ptr nocapture noundef readonly %x, i32 noundef %z) local_unnamed_addr #0 {
entry:
%cmp9 = icmp sgt i32 %z, 0
br i1 %cmp9, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %entry
%sub = add nsw i32 %z, -1
%0 = zext i32 %sub to i64
%wide.trip.count = zext i32 %z to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret void
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %x, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%cmp1 = icmp ult i64 %indvars.iv, %0
%. = select i1 %cmp1, i32 32, i32 10
%putchar8 = tail call i32 @putchar(i32 %.)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%cmp30 = icmp sgt i32 %y, 1
br i1 %cmp30, label %for.body.us.preheader, label %for.end
for.body.us.preheader: ; preds = %entry
%sub.i = add nsw i32 %y, -1
%0 = zext i32 %sub.i to i64
%wide.trip.count.i = zext i32 %y to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %process.exit.loopexit.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %process.exit.loopexit.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %x, i64 %indvars.iv
%1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv33 = phi i64 [ %indvars.iv.next34, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next34 = add nsw i64 %indvars.iv33, -1
%idxprom2.us = and i64 %indvars.iv.next34, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %x, i64 %idxprom2.us
%2 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp sgt i32 %2, %1
br i1 %cmp4.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv33, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom10.us = ashr exact i64 %sext, 32
%arrayidx11.us = getelementptr inbounds i32, ptr %x, i64 %idxprom10.us
store i32 %1, ptr %arrayidx11.us, align 4, !tbaa !5
br label %for.body.i.us
for.body.i.us: ; preds = %for.body.i.us, %while.end.us
%indvars.iv.i.us = phi i64 [ 0, %while.end.us ], [ %indvars.iv.next.i.us, %for.body.i.us ]
%arrayidx.i.us = getelementptr inbounds i32, ptr %x, i64 %indvars.iv.i.us
%3 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%call.i.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3)
%cmp1.i.us = icmp ult i64 %indvars.iv.i.us, %0
%..i.us = select i1 %cmp1.i.us, i32 32, i32 10
%putchar8.i.us = tail call i32 @putchar(i32 %..i.us)
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %process.exit.loopexit.us, label %for.body.i.us, !llvm.loop !9
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %x, i64 %indvars.iv33
store i32 %2, ptr %arrayidx8.us, align 4, !tbaa !5
%4 = icmp sgt i64 %indvars.iv33, 1
br i1 %4, label %land.rhs.us, label %while.end.us, !llvm.loop !11
process.exit.loopexit.us: ; preds = %for.body.i.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count.i
br i1 %exitcond.not, label %for.end, label %for.body.us, !llvm.loop !12
for.end: ; preds = %process.exit.loopexit.us, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%hand = alloca [101 x i32], align 16
%order = alloca [1000000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %hand) #5
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %order) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !13
%call = call ptr @fgets(ptr noundef nonnull %order, i32 noundef 300, ptr noundef %0)
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %order, ptr noundef nonnull @.str, ptr noundef nonnull %n) #5
%1 = load ptr, ptr @stdin, align 8, !tbaa !13
%call4 = call ptr @fgets(ptr noundef nonnull %order, i32 noundef 1000000, ptr noundef %1)
%call6 = call ptr @strtok(ptr noundef nonnull %order, ptr noundef nonnull @.str.3) #5
%call7 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %call6, ptr noundef nonnull @.str, ptr noundef nonnull %hand) #5
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %2, 1
br i1 %cmp20, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %2, %entry ], [ %10, %for.body ]
%cmp9.i = icmp sgt i32 %.lcssa, 0
br i1 %cmp9.i, label %for.body.lr.ph.i, label %insertionSort.exit
for.body.lr.ph.i: ; preds = %for.cond.cleanup
%sub.i = add nsw i32 %.lcssa, -1
%3 = zext i32 %sub.i to i64
%wide.trip.count.i = zext i32 %.lcssa to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.lr.ph.i
%indvars.iv.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next.i, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %hand, i64 %indvars.iv.i
%4 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%cmp1.i = icmp ult i64 %indvars.iv.i, %3
%..i = select i1 %cmp1.i, i32 32, i32 10
%putchar8.i = call i32 @putchar(i32 %..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
br i1 %exitcond.not.i, label %process.exit, label %for.body.i, !llvm.loop !9
process.exit: ; preds = %for.body.i
%.pr = load i32, ptr %n, align 4, !tbaa !5
%cmp30.i = icmp sgt i32 %.pr, 1
br i1 %cmp30.i, label %for.body.us.preheader.i, label %insertionSort.exit
for.body.us.preheader.i: ; preds = %process.exit
%sub.i.i = add nsw i32 %.pr, -1
%5 = zext i32 %sub.i.i to i64
%wide.trip.count.i.i = zext i32 %.pr to i64
br label %for.body.us.i
for.body.us.i: ; preds = %process.exit.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv.i16 = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i17, %process.exit.loopexit.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %hand, i64 %indvars.iv.i16
%6 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv33.i = phi i64 [ %indvars.iv.next34.i, %while.body.us.i ], [ %indvars.iv.i16, %for.body.us.i ]
%indvars.iv.next34.i = add nsw i64 %indvars.iv33.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next34.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr %hand, i64 %idxprom2.us.i
%7 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp sgt i32 %7, %6
br i1 %cmp4.us.i, label %while.body.us.i, label %while.end.us.i
while.end.us.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv33.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom10.us.i = ashr exact i64 %sext.i, 32
%arrayidx11.us.i = getelementptr inbounds i32, ptr %hand, i64 %idxprom10.us.i
store i32 %6, ptr %arrayidx11.us.i, align 4, !tbaa !5
br label %for.body.i.us.i
for.body.i.us.i: ; preds = %for.body.i.us.i, %while.end.us.i
%indvars.iv.i.us.i = phi i64 [ 0, %while.end.us.i ], [ %indvars.iv.next.i.us.i, %for.body.i.us.i ]
%arrayidx.i.us.i = getelementptr inbounds i32, ptr %hand, i64 %indvars.iv.i.us.i
%8 = load i32, ptr %arrayidx.i.us.i, align 4, !tbaa !5
%call.i.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8)
%cmp1.i.us.i = icmp ult i64 %indvars.iv.i.us.i, %5
%..i.us.i = select i1 %cmp1.i.us.i, i32 32, i32 10
%putchar8.i.us.i = call i32 @putchar(i32 %..i.us.i)
%indvars.iv.next.i.us.i = add nuw nsw i64 %indvars.iv.i.us.i, 1
%exitcond.not.i.us.i = icmp eq i64 %indvars.iv.next.i.us.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.us.i, label %process.exit.loopexit.us.i, label %for.body.i.us.i, !llvm.loop !9
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr %hand, i64 %indvars.iv33.i
store i32 %7, ptr %arrayidx8.us.i, align 4, !tbaa !5
%9 = icmp sgt i64 %indvars.iv33.i, 1
br i1 %9, label %land.rhs.us.i, label %while.end.us.i, !llvm.loop !11
process.exit.loopexit.us.i: ; preds = %for.body.i.us.i
%indvars.iv.next.i17 = add nuw nsw i64 %indvars.iv.i16, 1
%exitcond.not.i18 = icmp eq i64 %indvars.iv.next.i17, %wide.trip.count.i.i
br i1 %exitcond.not.i18, label %insertionSort.exit, label %for.body.us.i, !llvm.loop !12
insertionSort.exit: ; preds = %process.exit.loopexit.us.i, %for.cond.cleanup, %process.exit
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %order) #5
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %hand) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%call8 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str.3) #5
%arrayidx9 = getelementptr inbounds [101 x i32], ptr %hand, i64 0, i64 %indvars.iv
%call10 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %call8, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9) #5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp = icmp slt i64 %indvars.iv.next, %11
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !15
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn
declare ptr @strtok(ptr noundef, ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int main(){
int i,j,v,N;
int A[1000];
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&A[i]);
}
for(i=0;i<N-1;i++){
printf("%d ",A[i]);
}
printf("%d",A[N-1]);
printf("\n");
for(i=1;i<N;i++){
v=A[i];
j=i-1;
while(j>=0&&A[j]>v){
A[j+1]=A[j];
j--;
}
A[j+1]=v;
for(j=0;j<N-1;j++){
printf("%d ", A[j]);
}
printf("%d",A[N-1]);
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116694/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116694/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp70 = icmp sgt i32 %0, 0
br i1 %cmp70, label %for.body, label %for.cond2.preheader.for.end10_crit_edge
for.cond2.preheader: ; preds = %for.body
%cmp373 = icmp sgt i32 %2, 1
br i1 %cmp373, label %for.body4, label %for.cond2.preheader.for.end10_crit_edge
for.cond2.preheader.for.end10_crit_edge: ; preds = %entry, %for.cond2.preheader
%1 = phi i32 [ %2, %for.cond2.preheader ], [ %0, %entry ]
%sub72 = add nsw i32 %1, -1
%.pre = sext i32 %sub72 to i64
br label %for.end10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv87
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next88, %6
br i1 %cmp3, label %for.body4, label %for.end10, !llvm.loop !11
for.end10: ; preds = %for.body4, %for.cond2.preheader.for.end10_crit_edge
%idxprom12.pre-phi = phi i64 [ %.pre, %for.cond2.preheader.for.end10_crit_edge ], [ %6, %for.body4 ]
%arrayidx13 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom12.pre-phi
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr %N, align 4, !tbaa !5
%cmp1782 = icmp sgt i32 %8, 1
br i1 %cmp1782, label %for.body18, label %for.end50
for.body18: ; preds = %for.end10, %for.end42
%9 = phi i32 [ %17, %for.end42 ], [ %8, %for.end10 ]
%indvars.iv90 = phi i64 [ %indvars.iv.next91, %for.end42 ], [ 1, %for.end10 ]
%arrayidx20 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv90
%10 = load i32, ptr %arrayidx20, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body18, %while.body
%indvars.iv92 = phi i64 [ %indvars.iv90, %for.body18 ], [ %indvars.iv.next93, %while.body ]
%indvars.iv.next93 = add nsw i64 %indvars.iv92, -1
%idxprom23 = and i64 %indvars.iv.next93, 4294967295
%arrayidx24 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom23
%11 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %11, %10
br i1 %cmp25, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx29 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv92
store i32 %11, ptr %arrayidx29, align 4, !tbaa !5
%12 = icmp sgt i64 %indvars.iv92, 1
br i1 %12, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv92, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom31 = ashr exact i64 %sext, 32
%arrayidx32 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom31
store i32 %10, ptr %arrayidx32, align 4, !tbaa !5
%cmp3579 = icmp sgt i32 %9, 1
br i1 %cmp3579, label %for.body36, label %while.end.for.end42_crit_edge
while.end.for.end42_crit_edge: ; preds = %while.end
%sub3478 = add nsw i32 %9, -1
%.pre101 = sext i32 %sub3478 to i64
br label %for.end42
for.body36: ; preds = %while.end, %for.body36
%indvars.iv95 = phi i64 [ %indvars.iv.next96, %for.body36 ], [ 0, %while.end ]
%arrayidx38 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv95
%13 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
%indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
%14 = load i32, ptr %N, align 4, !tbaa !5
%sub34 = add nsw i32 %14, -1
%15 = sext i32 %sub34 to i64
%cmp35 = icmp slt i64 %indvars.iv.next96, %15
br i1 %cmp35, label %for.body36, label %for.end42, !llvm.loop !13
for.end42: ; preds = %for.body36, %while.end.for.end42_crit_edge
%idxprom44.pre-phi = phi i64 [ %.pre101, %while.end.for.end42_crit_edge ], [ %15, %for.body36 ]
%arrayidx45 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom44.pre-phi
%16 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %16)
%putchar69 = call i32 @putchar(i32 10)
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%17 = load i32, ptr %N, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp17 = icmp slt i64 %indvars.iv.next91, %18
br i1 %cmp17, label %for.body18, label %for.end50, !llvm.loop !14
for.end50: ; preds = %for.end42, %for.end10
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main()
{
int A[1000];
int N,i,j,l,v;
scanf("%d",&N);
for(i = 0; i < N; i++)scanf("%d",&A[i]);
for(i = 0; i < N; i++)
{
v = A[i];
j = i - 1;
while(j >= 0 && A[j] > v)
{
A[j+1] = A[j];
j--;
A[j+1] = v;
}
for(l = 0; l < N; l++)
{
if(l>0) printf(" ");
printf("%d",A[l]);
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116737/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116737/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [1000 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp50 = icmp sgt i32 %0, 0
br i1 %cmp50, label %for.body, label %for.end32
for.cond2.preheader: ; preds = %for.body
%cmp358 = icmp sgt i32 %1, 0
br i1 %cmp358, label %for.body4, label %for.end32
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.end28
%3 = phi i32 [ %11, %for.end28 ], [ %1, %for.cond2.preheader ]
%indvars.iv61 = phi i64 [ %indvars.iv.next62, %for.end28 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv61
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp753.not = icmp eq i64 %indvars.iv61, 0
br i1 %cmp753.not, label %while.end, label %land.rhs
land.rhs: ; preds = %for.body4, %while.body
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %while.body ], [ %indvars.iv61, %for.body4 ]
%indvars.iv.next64 = add nsw i64 %indvars.iv63, -1
%idxprom8 = and i64 %indvars.iv.next64, 4294967295
%arrayidx9 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %idxprom8
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %5, %4
br i1 %cmp10, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv63
store i32 %5, ptr %arrayidx14, align 4, !tbaa !5
store i32 %4, ptr %arrayidx9, align 4, !tbaa !5
%6 = icmp sgt i64 %indvars.iv63, 1
br i1 %6, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %land.rhs, %while.body, %for.body4
%cmp1956 = icmp sgt i32 %3, 0
br i1 %cmp1956, label %if.end.peel, label %for.end28
if.end.peel: ; preds = %while.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call25.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%7 = load i32, ptr %N, align 4, !tbaa !5
%cmp19.peel = icmp sgt i32 %7, 1
br i1 %cmp19.peel, label %if.end, label %for.end28
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %if.end ], [ 1, %if.end.peel ]
%putchar49 = call i32 @putchar(i32 32)
%arrayidx24 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv66
%8 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8)
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%9 = load i32, ptr %N, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp19 = icmp slt i64 %indvars.iv.next67, %10
br i1 %cmp19, label %if.end, label %for.end28, !llvm.loop !12
for.end28: ; preds = %if.end, %if.end.peel, %while.end
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%11 = load i32, ptr %N, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp3 = icmp slt i64 %indvars.iv.next62, %12
br i1 %cmp3, label %for.body4, label %for.end32, !llvm.loop !14
for.end32: ; preds = %for.end28, %entry, %for.cond2.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main (){
int len , arr[100] , i ,j ,v, o;
scanf("%d", &len);
for ( i = 0; i < len; i++){
scanf("%d", &arr[i]);
}
/*
insertionSort(A, N) // N個の要素を含む0-オリジンの配列A
2 for i が 1 から N-1 まで
3 v = A[i]
4 j = i - 1
5 while j >= 0 かつ A[j] > v
6 A[j+1] = A[j]
7 j--
8 A[j+1] = v
*/
for (i = 0; i < len; i++){
v = arr[i];
j = i -1;
while( j >= 0 && arr[j] > v){
arr[j+1] =arr[j];
j--;
}
arr[j+1] = v;
for ( o =0 ; o < len; o++){
printf("%d", arr[o]);
if ( o < len -1) printf(" ");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116780/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116780/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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:
%len = alloca i32, align 4
%arr = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %len) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %arr) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %len)
%0 = load i32, ptr %len, align 4, !tbaa !5
%cmp50 = icmp sgt i32 %0, 0
br i1 %cmp50, label %for.body, label %for.end33
for.cond2.preheader: ; preds = %for.body
%cmp359 = icmp sgt i32 %1, 0
br i1 %cmp359, label %for.body4, label %for.end33
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %arr, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %len, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.end29
%3 = phi i32 [ %12, %for.end29 ], [ %1, %for.cond2.preheader ]
%indvars.iv62 = phi i64 [ %indvars.iv.next63, %for.end29 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %arr, i64 0, i64 %indvars.iv62
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp753.not = icmp eq i64 %indvars.iv62, 0
br i1 %cmp753.not, label %while.end, label %land.rhs
land.rhs: ; preds = %for.body4, %while.body
%indvars.iv64 = phi i64 [ %indvars.iv.next65, %while.body ], [ %indvars.iv62, %for.body4 ]
%indvars.iv.next65 = add nsw i64 %indvars.iv64, -1
%idxprom8 = and i64 %indvars.iv.next65, 4294967295
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %arr, i64 0, i64 %idxprom8
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %5, %4
br i1 %cmp10, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx14 = getelementptr inbounds [100 x i32], ptr %arr, i64 0, i64 %indvars.iv64
store i32 %5, ptr %arrayidx14, align 4, !tbaa !5
%6 = icmp sgt i64 %indvars.iv64, 1
br i1 %6, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %land.rhs, %while.body, %for.body4
%j.0.in.lcssa = phi i64 [ 0, %for.body4 ], [ 0, %while.body ], [ %indvars.iv64, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom16 = ashr exact i64 %sext, 32
%arrayidx17 = getelementptr inbounds [100 x i32], ptr %arr, i64 0, i64 %idxprom16
store i32 %4, ptr %arrayidx17, align 4, !tbaa !5
%cmp1957 = icmp sgt i32 %3, 0
br i1 %cmp1957, label %for.body20, label %for.end29
for.body20: ; preds = %while.end, %for.inc27
%indvars.iv67 = phi i64 [ %indvars.iv.next68, %for.inc27 ], [ 0, %while.end ]
%arrayidx22 = getelementptr inbounds [100 x i32], ptr %arr, i64 0, i64 %indvars.iv67
%7 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
%8 = load i32, ptr %len, align 4, !tbaa !5
%sub24 = add nsw i32 %8, -1
%9 = sext i32 %sub24 to i64
%cmp25 = icmp slt i64 %indvars.iv67, %9
br i1 %cmp25, label %if.then, label %for.inc27
if.then: ; preds = %for.body20
%putchar49 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %len, align 4, !tbaa !5
br label %for.inc27
for.inc27: ; preds = %for.body20, %if.then
%10 = phi i32 [ %8, %for.body20 ], [ %.pre, %if.then ]
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%11 = sext i32 %10 to i64
%cmp19 = icmp slt i64 %indvars.iv.next68, %11
br i1 %cmp19, label %for.body20, label %for.end29, !llvm.loop !12
for.end29: ; preds = %for.inc27, %while.end
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%12 = load i32, ptr %len, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp3 = icmp slt i64 %indvars.iv.next63, %13
br i1 %cmp3, label %for.body4, label %for.end33, !llvm.loop !13
for.end33: ; preds = %for.end29, %entry, %for.cond2.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %arr) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %len) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#define N 100
void insertionSort(int *,int);
int main()
{
int n,i;
int a[N];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
insertionSort(a,n);
return 0;
}
void insertionSort(int *a,int n){
int i,j,x=0,k;
for(i=0;i<n;i++){
x=a[i];
j=i-1;
while(j>=0&&a[j]>x){
a[j+1]=a[j];
j--;
a[j+1]=x;
}
for(k=0;k<n;k++){
if(k>0)printf(" ");
printf("%d",a[k]);
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116823/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116823/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %0, 0
br i1 %cmp4, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%.lcssa.fr = freeze i32 %.lcssa
%cmp49.i = icmp sgt i32 %.lcssa.fr, 0
br i1 %cmp49.i, label %for.body.us.preheader.i, label %insertionSort.exit
for.body.us.preheader.i: ; preds = %for.end
%wide.trip.count61.i = zext i32 %.lcssa.fr to i64
%exitcond.peel.not.i = icmp eq i32 %.lcssa.fr, 1
br i1 %exitcond.peel.not.i, label %if.end.us.peel.i.us, label %for.body.us.i
if.end.us.peel.i.us: ; preds = %for.body.us.preheader.i
%3 = load i32, ptr %a, align 16, !tbaa !5
%call18.us.peel.i.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3)
%putchar.us.i.us = call i32 @putchar(i32 10)
br label %insertionSort.exit
for.body.us.i: ; preds = %for.body.us.preheader.i, %for.cond12.for.end_crit_edge.us.i.loopexit
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.cond12.for.end_crit_edge.us.i.loopexit ], [ 0, %for.body.us.preheader.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i
%4 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
%cmp144.us.not.i = icmp eq i64 %indvars.iv.i, 0
br i1 %cmp144.us.not.i, label %if.end.us.peel.i, label %land.rhs.us.i
land.rhs.us.i: ; preds = %for.body.us.i, %while.body.us.i
%indvars.iv51.i = phi i64 [ %indvars.iv.next52.i, %while.body.us.i ], [ %indvars.iv.i, %for.body.us.i ]
%indvars.iv.next52.i = add nsw i64 %indvars.iv51.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next52.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr %a, i64 %idxprom2.us.i
%5 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp sgt i32 %5, %4
br i1 %cmp4.us.i, label %while.body.us.i, label %if.end.us.peel.i
if.end.us.peel.i: ; preds = %while.body.us.i, %land.rhs.us.i, %for.body.us.i
%.pre.i = load i32, ptr %a, align 16, !tbaa !5
%call18.us.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre.i)
br label %if.end.us.i
if.end.us.i: ; preds = %if.end.us.peel.i, %if.end.us.i
%indvars.iv54.i = phi i64 [ %indvars.iv.next55.i, %if.end.us.i ], [ 1, %if.end.us.peel.i ]
%putchar42.us.i = call i32 @putchar(i32 32)
%arrayidx17.us.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv54.i
%6 = load i32, ptr %arrayidx17.us.i, align 4, !tbaa !5
%call18.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%indvars.iv.next55.i = add nuw nsw i64 %indvars.iv54.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next55.i, %wide.trip.count61.i
br i1 %exitcond.not.i, label %for.cond12.for.end_crit_edge.us.i.loopexit, label %if.end.us.i, !llvm.loop !11
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv51.i
store i32 %5, ptr %arrayidx8.us.i, align 4, !tbaa !5
store i32 %4, ptr %arrayidx3.us.i, align 4, !tbaa !5
%7 = icmp sgt i64 %indvars.iv51.i, 1
br i1 %7, label %land.rhs.us.i, label %if.end.us.peel.i, !llvm.loop !13
for.cond12.for.end_crit_edge.us.i.loopexit: ; preds = %if.end.us.i
%putchar.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond62.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count61.i
br i1 %exitcond62.not.i, label %insertionSort.exit, label %for.body.us.i, !llvm.loop !14
insertionSort.exit: ; preds = %for.cond12.for.end_crit_edge.us.i.loopexit, %if.end.us.peel.i.us, %for.end
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @insertionSort(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp49 = icmp sgt i32 %n, 0
br i1 %cmp49, label %for.body.us.preheader, label %for.end22
for.body.us.preheader: ; preds = %entry
%wide.trip.count61 = zext i32 %n to i64
%exitcond.peel.not = icmp eq i32 %n, 1
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond12.for.end_crit_edge.us
%indvars.iv = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next, %for.cond12.for.end_crit_edge.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%0 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
%cmp144.us.not = icmp eq i64 %indvars.iv, 0
br i1 %cmp144.us.not, label %if.end.us.peel, label %land.rhs.us
land.rhs.us: ; preds = %for.body.us, %while.body.us
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next52 = add nsw i64 %indvars.iv51, -1
%idxprom2.us = and i64 %indvars.iv.next52, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %a, i64 %idxprom2.us
%1 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp sgt i32 %1, %0
br i1 %cmp4.us, label %while.body.us, label %if.end.us.peel
if.end.us.peel: ; preds = %land.rhs.us, %while.body.us, %for.body.us
%.pre = load i32, ptr %a, align 4, !tbaa !5
%call18.us.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
br i1 %exitcond.peel.not, label %for.cond12.for.end_crit_edge.us, label %if.end.us
if.end.us: ; preds = %if.end.us.peel, %if.end.us
%indvars.iv54 = phi i64 [ %indvars.iv.next55, %if.end.us ], [ 1, %if.end.us.peel ]
%putchar42.us = tail call i32 @putchar(i32 32)
%arrayidx17.us = getelementptr inbounds i32, ptr %a, i64 %indvars.iv54
%2 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5
%call18.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count61
br i1 %exitcond.not, label %for.cond12.for.end_crit_edge.us, label %if.end.us, !llvm.loop !11
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %a, i64 %indvars.iv51
store i32 %1, ptr %arrayidx8.us, align 4, !tbaa !5
store i32 %0, ptr %arrayidx3.us, align 4, !tbaa !5
%3 = icmp sgt i64 %indvars.iv51, 1
br i1 %3, label %land.rhs.us, label %if.end.us.peel, !llvm.loop !13
for.cond12.for.end_crit_edge.us: ; preds = %if.end.us, %if.end.us.peel
%putchar.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond62.not = icmp eq i64 %indvars.iv.next, %wide.trip.count61
br i1 %exitcond62.not, label %for.end22, label %for.body.us, !llvm.loop !14
for.end22: ; preds = %for.cond12.for.end_crit_edge.us, %entry
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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(){
int n, i, j, key, k;
scanf("%d", &n);
int A[n];
for(i = 0 ; i < n ; i++){
scanf("%d", &A[i]);
}
for(k = 0 ; k < n ; k++){
if(k == n - 1)printf("%d", A[k]);
else printf("%d ", A[k]);
}
printf("\n");
for(i = 1 ; i < n ; i++){
key = A[i];
j = i - 1;
while(j >= 0 && A[j] > key){
A[j + 1] = A[j];
j--;
}
A[j + 1] = key;
for(k = 0 ; k < n ; k++){
if(k == n - 1)printf("%d", A[k]);
else printf("%d ", A[k]);
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116867/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116867/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp78 = icmp sgt i32 %3, 0
br i1 %cmp78, label %for.body, label %for.end14
for.cond2.preheader: ; preds = %for.body
%cmp380 = icmp sgt i32 %4, 0
br i1 %cmp380, label %for.body4, label %for.end14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv90 = phi i64 [ %indvars.iv.next91, %for.body4 ], [ 0, %for.cond2.preheader ]
%6 = phi i32 [ %9, %for.body4 ], [ %4, %for.cond2.preheader ]
%sub = add nsw i32 %6, -1
%7 = zext i32 %sub to i64
%cmp5 = icmp eq i64 %indvars.iv90, %7
%arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv90
%8 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%.str..str.1 = select i1 %cmp5, ptr @.str, ptr @.str.1
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1, i32 noundef %8)
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp3 = icmp slt i64 %indvars.iv.next91, %10
br i1 %cmp3, label %for.body4, label %for.end14, !llvm.loop !11
for.end14: ; preds = %for.body4, %entry, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp1787 = icmp sgt i32 %11, 1
br i1 %cmp1787, label %for.body18, label %for.end53
for.body18: ; preds = %for.end14, %for.end49
%12 = phi i32 [ %21, %for.end49 ], [ %11, %for.end14 ]
%indvars.iv93 = phi i64 [ %indvars.iv.next94, %for.end49 ], [ 1, %for.end14 ]
%arrayidx20 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv93
%13 = load i32, ptr %arrayidx20, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body18, %while.body
%indvars.iv95 = phi i64 [ %indvars.iv93, %for.body18 ], [ %indvars.iv.next96, %while.body ]
%indvars.iv.next96 = add nsw i64 %indvars.iv95, -1
%idxprom23 = and i64 %indvars.iv.next96, 4294967295
%arrayidx24 = getelementptr inbounds i32, ptr %vla, i64 %idxprom23
%14 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %14, %13
br i1 %cmp25, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%arrayidx29 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv95
store i32 %14, ptr %arrayidx29, align 4, !tbaa !5
%15 = icmp sgt i64 %indvars.iv95, 1
br i1 %15, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %land.rhs
%j.0.in.lcssa = phi i64 [ 0, %while.body ], [ %indvars.iv95, %land.rhs ]
%sext = shl i64 %j.0.in.lcssa, 32
%idxprom31 = ashr exact i64 %sext, 32
%arrayidx32 = getelementptr inbounds i32, ptr %vla, i64 %idxprom31
store i32 %13, ptr %arrayidx32, align 4, !tbaa !5
%cmp3485 = icmp sgt i32 %12, 0
br i1 %cmp3485, label %for.body35, label %for.end49
for.body35: ; preds = %while.end, %for.body35
%indvars.iv98 = phi i64 [ %indvars.iv.next99, %for.body35 ], [ 0, %while.end ]
%16 = phi i32 [ %19, %for.body35 ], [ %12, %while.end ]
%sub36 = add nsw i32 %16, -1
%17 = zext i32 %sub36 to i64
%cmp37 = icmp eq i64 %indvars.iv98, %17
%arrayidx40 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv98
%18 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%.str..str.1106 = select i1 %cmp37, ptr @.str, ptr @.str.1
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1106, i32 noundef %18)
%indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp34 = icmp slt i64 %indvars.iv.next99, %20
br i1 %cmp34, label %for.body35, label %for.end49, !llvm.loop !13
for.end49: ; preds = %for.body35, %while.end
%putchar77 = call i32 @putchar(i32 10)
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%21 = load i32, ptr %n, align 4, !tbaa !5
%22 = sext i32 %21 to i64
%cmp17 = icmp slt i64 %indvars.iv.next94, %22
br i1 %cmp17, label %for.body18, label %for.end53, !llvm.loop !14
for.end53: ; preds = %for.end49, %for.end14
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <assert.h>
int main()
{
int t;
scanf("%d",&t);
while(t--){
int n;scanf("%d",&n);
int a[10005],b[10005];int max1=0,max2=0;
memset(a,0,sizeof(a));memset(b,0,sizeof(b));
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(int i=0;i<n;i++){
scanf("%d",&b[i]);
}
int te;
for(int i=0;i<n;i++){
if(a[i]<b[i]) {
te=a[i];a[i]=b[i];b[i]=te;
}
}
for(int i=0;i<n;i++){
if(a[i]>max1) max1=a[i];
}
for(int i=0;i<n;i++){
if(b[i]>max2) max2=b[i];
}
printf("%d\n",max1*max2);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11691/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11691/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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
%a = alloca [10005 x i32], align 16
%b = alloca [10005 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec104 = add nsw i32 %0, -1
store i32 %dec104, ptr %t, align 4, !tbaa !5
%tobool.not105 = icmp eq i32 %0, 0
br i1 %tobool.not105, label %while.end, label %while.body
while.body: ; preds = %entry, %for.cond.cleanup54
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 40020, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 40020, ptr nonnull %b) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40020) %a, i8 0, i64 40020, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40020) %b, i8 0, i64 40020, i1 false)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp90 = icmp sgt i32 %1, 0
br i1 %cmp90, label %for.body, label %for.cond.cleanup54
for.cond5.preheader: ; preds = %for.body
%cmp692 = icmp sgt i32 %2, 0
br i1 %cmp692, label %for.body8, label %for.cond.cleanup54
for.body: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.body ]
%arrayidx = getelementptr inbounds [10005 x i32], ptr %a, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.cond16.preheader: ; preds = %for.body8
%cmp1794 = icmp sgt i32 %5, 0
br i1 %cmp1794, label %for.body19.preheader, label %for.cond.cleanup54
for.body19.preheader: ; preds = %for.cond16.preheader
%wide.trip.count = zext i32 %5 to i64
%xtraiter = and i64 %wide.trip.count, 1
%4 = icmp eq i32 %5, 1
br i1 %4, label %for.cond37.preheader.unr-lcssa, label %for.body19.preheader.new
for.body19.preheader.new: ; preds = %for.body19.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body19
for.body8: ; preds = %for.cond5.preheader, %for.body8
%indvars.iv108 = phi i64 [ %indvars.iv.next109, %for.body8 ], [ 0, %for.cond5.preheader ]
%arrayidx10 = getelementptr inbounds [10005 x i32], ptr %b, i64 0, i64 %indvars.iv108
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx10)
%indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp6 = icmp slt i64 %indvars.iv.next109, %6
br i1 %cmp6, label %for.body8, label %for.cond16.preheader, !llvm.loop !11
for.cond37.preheader.unr-lcssa: ; preds = %for.inc33.1, %for.body19.preheader
%indvars.iv111.unr = phi i64 [ 0, %for.body19.preheader ], [ %indvars.iv.next112.1, %for.inc33.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond37.preheader, label %for.body19.epil
for.body19.epil: ; preds = %for.cond37.preheader.unr-lcssa
%arrayidx21.epil = getelementptr inbounds [10005 x i32], ptr %a, i64 0, i64 %indvars.iv111.unr
%7 = load i32, ptr %arrayidx21.epil, align 4, !tbaa !5
%arrayidx23.epil = getelementptr inbounds [10005 x i32], ptr %b, i64 0, i64 %indvars.iv111.unr
%8 = load i32, ptr %arrayidx23.epil, align 4, !tbaa !5
%cmp24.epil = icmp slt i32 %7, %8
br i1 %cmp24.epil, label %if.then.epil, label %for.cond37.preheader
if.then.epil: ; preds = %for.body19.epil
store i32 %8, ptr %arrayidx21.epil, align 4, !tbaa !5
store i32 %7, ptr %arrayidx23.epil, align 4, !tbaa !5
br label %for.cond37.preheader
for.cond37.preheader: ; preds = %for.body19.epil, %if.then.epil, %for.cond37.preheader.unr-lcssa
br i1 %cmp1794, label %for.body40.preheader, label %for.cond.cleanup54
for.body40.preheader: ; preds = %for.cond37.preheader
%wide.trip.count117 = zext i32 %5 to i64
%min.iters.check145 = icmp ult i32 %5, 8
br i1 %min.iters.check145, label %for.body40.preheader161, label %vector.ph146
vector.ph146: ; preds = %for.body40.preheader
%n.vec148 = and i64 %wide.trip.count, 4294967288
br label %vector.body151
vector.body151: ; preds = %vector.body151, %vector.ph146
%index152 = phi i64 [ 0, %vector.ph146 ], [ %index.next157, %vector.body151 ]
%vec.phi153 = phi <4 x i32> [ zeroinitializer, %vector.ph146 ], [ %11, %vector.body151 ]
%vec.phi154 = phi <4 x i32> [ zeroinitializer, %vector.ph146 ], [ %12, %vector.body151 ]
%9 = getelementptr inbounds [10005 x i32], ptr %a, i64 0, i64 %index152
%wide.load155 = load <4 x i32>, ptr %9, align 16, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
%wide.load156 = load <4 x i32>, ptr %10, align 16, !tbaa !5
%11 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load155, <4 x i32> %vec.phi153)
%12 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load156, <4 x i32> %vec.phi154)
%index.next157 = add nuw i64 %index152, 8
%13 = icmp eq i64 %index.next157, %n.vec148
br i1 %13, label %middle.block143, label %vector.body151, !llvm.loop !12
middle.block143: ; preds = %vector.body151
%rdx.minmax158 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %11, <4 x i32> %12)
%14 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax158)
%cmp.n150 = icmp eq i64 %n.vec148, %wide.trip.count
br i1 %cmp.n150, label %for.cond52.preheader, label %for.body40.preheader161
for.body40.preheader161: ; preds = %for.body40.preheader, %middle.block143
%indvars.iv114.ph = phi i64 [ 0, %for.body40.preheader ], [ %n.vec148, %middle.block143 ]
%max1.097.ph = phi i32 [ 0, %for.body40.preheader ], [ %14, %middle.block143 ]
br label %for.body40
for.body19: ; preds = %for.inc33.1, %for.body19.preheader.new
%indvars.iv111 = phi i64 [ 0, %for.body19.preheader.new ], [ %indvars.iv.next112.1, %for.inc33.1 ]
%niter = phi i64 [ 0, %for.body19.preheader.new ], [ %niter.next.1, %for.inc33.1 ]
%arrayidx21 = getelementptr inbounds [10005 x i32], ptr %a, i64 0, i64 %indvars.iv111
%15 = load i32, ptr %arrayidx21, align 8, !tbaa !5
%arrayidx23 = getelementptr inbounds [10005 x i32], ptr %b, i64 0, i64 %indvars.iv111
%16 = load i32, ptr %arrayidx23, align 8, !tbaa !5
%cmp24 = icmp slt i32 %15, %16
br i1 %cmp24, label %if.then, label %for.inc33
if.then: ; preds = %for.body19
store i32 %16, ptr %arrayidx21, align 8, !tbaa !5
store i32 %15, ptr %arrayidx23, align 8, !tbaa !5
br label %for.inc33
for.inc33: ; preds = %for.body19, %if.then
%indvars.iv.next112 = or i64 %indvars.iv111, 1
%arrayidx21.1 = getelementptr inbounds [10005 x i32], ptr %a, i64 0, i64 %indvars.iv.next112
%17 = load i32, ptr %arrayidx21.1, align 4, !tbaa !5
%arrayidx23.1 = getelementptr inbounds [10005 x i32], ptr %b, i64 0, i64 %indvars.iv.next112
%18 = load i32, ptr %arrayidx23.1, align 4, !tbaa !5
%cmp24.1 = icmp slt i32 %17, %18
br i1 %cmp24.1, label %if.then.1, label %for.inc33.1
if.then.1: ; preds = %for.inc33
store i32 %18, ptr %arrayidx21.1, align 4, !tbaa !5
store i32 %17, ptr %arrayidx23.1, align 4, !tbaa !5
br label %for.inc33.1
for.inc33.1: ; preds = %if.then.1, %for.inc33
%indvars.iv.next112.1 = add nuw nsw i64 %indvars.iv111, 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.cond37.preheader.unr-lcssa, label %for.body19, !llvm.loop !15
for.cond52.preheader: ; preds = %for.body40, %middle.block143
%spec.select.lcssa = phi i32 [ %14, %middle.block143 ], [ %spec.select, %for.body40 ]
br i1 %cmp1794, label %for.body55.preheader, label %for.cond.cleanup54
for.body55.preheader: ; preds = %for.cond52.preheader
%wide.trip.count122 = zext i32 %5 to i64
%min.iters.check = icmp ult i32 %5, 8
br i1 %min.iters.check, label %for.body55.preheader160, label %vector.ph
vector.ph: ; preds = %for.body55.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %21, %vector.body ]
%vec.phi141 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %22, %vector.body ]
%19 = getelementptr inbounds [10005 x i32], ptr %b, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
%wide.load142 = load <4 x i32>, ptr %20, align 16, !tbaa !5
%21 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi)
%22 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load142, <4 x i32> %vec.phi141)
%index.next = add nuw i64 %index, 8
%23 = icmp eq i64 %index.next, %n.vec
br i1 %23, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %21, <4 x i32> %22)
%24 = 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.cond.cleanup54, label %for.body55.preheader160
for.body55.preheader160: ; preds = %for.body55.preheader, %middle.block
%indvars.iv119.ph = phi i64 [ 0, %for.body55.preheader ], [ %n.vec, %middle.block ]
%max2.0101.ph = phi i32 [ 0, %for.body55.preheader ], [ %24, %middle.block ]
br label %for.body55
for.body40: ; preds = %for.body40.preheader161, %for.body40
%indvars.iv114 = phi i64 [ %indvars.iv.next115, %for.body40 ], [ %indvars.iv114.ph, %for.body40.preheader161 ]
%max1.097 = phi i32 [ %spec.select, %for.body40 ], [ %max1.097.ph, %for.body40.preheader161 ]
%arrayidx42 = getelementptr inbounds [10005 x i32], ptr %a, i64 0, i64 %indvars.iv114
%25 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %25, i32 %max1.097)
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%exitcond118.not = icmp eq i64 %indvars.iv.next115, %wide.trip.count117
br i1 %exitcond118.not, label %for.cond52.preheader, label %for.body40, !llvm.loop !17
for.cond.cleanup54: ; preds = %for.body55, %middle.block, %for.cond16.preheader, %while.body, %for.cond5.preheader, %for.cond37.preheader, %for.cond52.preheader
%max1.0.lcssa138 = phi i32 [ %spec.select.lcssa, %for.cond52.preheader ], [ 0, %for.cond37.preheader ], [ 0, %for.cond5.preheader ], [ 0, %while.body ], [ 0, %for.cond16.preheader ], [ %spec.select.lcssa, %middle.block ], [ %spec.select.lcssa, %for.body55 ]
%max2.0.lcssa = phi i32 [ 0, %for.cond52.preheader ], [ 0, %for.cond37.preheader ], [ 0, %for.cond5.preheader ], [ 0, %while.body ], [ 0, %for.cond16.preheader ], [ %24, %middle.block ], [ %spec.select89, %for.body55 ]
%mul = mul nsw i32 %max2.0.lcssa, %max1.0.lcssa138
%call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
call void @llvm.lifetime.end.p0(i64 40020, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 40020, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
%26 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %26, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %26, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !18
for.body55: ; preds = %for.body55.preheader160, %for.body55
%indvars.iv119 = phi i64 [ %indvars.iv.next120, %for.body55 ], [ %indvars.iv119.ph, %for.body55.preheader160 ]
%max2.0101 = phi i32 [ %spec.select89, %for.body55 ], [ %max2.0101.ph, %for.body55.preheader160 ]
%arrayidx57 = getelementptr inbounds [10005 x i32], ptr %b, i64 0, i64 %indvars.iv119
%27 = load i32, ptr %arrayidx57, align 4, !tbaa !5
%spec.select89 = call i32 @llvm.smax.i32(i32 %27, i32 %max2.0101)
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%exitcond123.not = icmp eq i64 %indvars.iv.next120, %wide.trip.count122
br i1 %exitcond123.not, label %for.cond.cleanup54, label %for.body55, !llvm.loop !19
while.end: ; preds = %for.cond.cleanup54, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; 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 <4 x i32> @llvm.smax.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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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}
!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}
!16 = distinct !{!16, !10, !13, !14}
!17 = distinct !{!17, !10, !14, !13}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !14, !13}
|
#include<stdio.h>
#define MAX 1000
void ISort(int A[],int N);
int main(void) {
int A[MAX];
int N, i;
scanf("%d", &N);
for(i=0; i<N; ++i){
scanf("%d", &A[i]);
}
for(i=0; i<N; i++) {
printf("%d", A[i]);
if(i != N-1)
printf(" ");
}
printf("\n");
ISort(A, N);
}
void ISort(int a[],int n) {
for(int i=1; i<n; ++i) {
int v = a[i];
int j = i-1;
while(j >= 0 && a[j] > v) {
a[j+1] = a[j];
j--;
}
a[j+1] = v;
for(int p=0; p<n; p++) {
printf("%d", a[p]);
if(p != n-1)
printf(" ");
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116953/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116953/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [1000 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.end12
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, label %for.end12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.inc10
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.inc10 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [1000 x i32], ptr %A, i64 0, i64 %indvars.iv26
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = zext i32 %sub to i64
%cmp8.not = icmp eq i64 %indvars.iv26, %6
br i1 %cmp8.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body4
%putchar20 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.inc10, %entry, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%9 = load i32, ptr %N, align 4, !tbaa !5
%cmp50.i = icmp sgt i32 %9, 1
br i1 %cmp50.i, label %for.body.us.preheader.i, label %ISort.exit
for.body.us.preheader.i: ; preds = %for.end12
%sub18.i = add nsw i32 %9, -1
%10 = zext i32 %sub18.i to i64
%wide.trip.count62.i = zext i32 %9 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond12.for.cond.cleanup14_crit_edge.us.i, %for.body.us.preheader.i
%indvars.iv.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next.i, %for.cond12.for.cond.cleanup14_crit_edge.us.i ]
%arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%11 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
br label %land.rhs.us.i
land.rhs.us.i: ; preds = %while.body.us.i, %for.body.us.i
%indvars.iv53.i = phi i64 [ %indvars.iv.next54.i, %while.body.us.i ], [ %indvars.iv.i, %for.body.us.i ]
%indvars.iv.next54.i = add nsw i64 %indvars.iv53.i, -1
%idxprom2.us.i = and i64 %indvars.iv.next54.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us.i
%12 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp sgt i32 %12, %11
br i1 %cmp4.us.i, label %while.body.us.i, label %while.end.us.i
while.end.us.i: ; preds = %while.body.us.i, %land.rhs.us.i
%j.0.in.lcssa.us.i = phi i64 [ 0, %while.body.us.i ], [ %indvars.iv53.i, %land.rhs.us.i ]
%sext.i = shl i64 %j.0.in.lcssa.us.i, 32
%idxprom10.us.i = ashr exact i64 %sext.i, 32
%arrayidx11.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom10.us.i
store i32 %11, ptr %arrayidx11.us.i, align 4, !tbaa !5
br label %for.body15.us.i
for.body15.us.i: ; preds = %for.inc.us.i, %while.end.us.i
%indvars.iv56.i = phi i64 [ 0, %while.end.us.i ], [ %indvars.iv.next57.i, %for.inc.us.i ]
%arrayidx17.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv56.i
%13 = load i32, ptr %arrayidx17.us.i, align 4, !tbaa !5
%call.us.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
%cmp19.not.us.i = icmp eq i64 %indvars.iv56.i, %10
br i1 %cmp19.not.us.i, label %for.inc.us.i, label %if.then.us.i
if.then.us.i: ; preds = %for.body15.us.i
%putchar44.us.i = call i32 @putchar(i32 32)
br label %for.inc.us.i
for.inc.us.i: ; preds = %if.then.us.i, %for.body15.us.i
%indvars.iv.next57.i = add nuw nsw i64 %indvars.iv56.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next57.i, %wide.trip.count62.i
br i1 %exitcond.not.i, label %for.cond12.for.cond.cleanup14_crit_edge.us.i, label %for.body15.us.i, !llvm.loop !12
while.body.us.i: ; preds = %land.rhs.us.i
%arrayidx8.us.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv53.i
store i32 %12, ptr %arrayidx8.us.i, align 4, !tbaa !5
%14 = icmp sgt i64 %indvars.iv53.i, 1
br i1 %14, label %land.rhs.us.i, label %while.end.us.i, !llvm.loop !13
for.cond12.for.cond.cleanup14_crit_edge.us.i: ; preds = %for.inc.us.i
%putchar.us.i = call i32 @putchar(i32 10)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond63.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count62.i
br i1 %exitcond63.not.i, label %ISort.exit, label %for.body.us.i, !llvm.loop !14
ISort.exit: ; preds = %for.cond12.for.cond.cleanup14_crit_edge.us.i, %for.end12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @ISort(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp50 = icmp sgt i32 %n, 1
br i1 %cmp50, label %for.body.us.preheader, label %for.cond.cleanup
for.body.us.preheader: ; preds = %entry
%sub18 = add nsw i32 %n, -1
%0 = zext i32 %sub18 to i64
%wide.trip.count62 = zext i32 %n to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond12.for.cond.cleanup14_crit_edge.us
%indvars.iv = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next, %for.cond12.for.cond.cleanup14_crit_edge.us ]
%arrayidx.us = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
br label %land.rhs.us
land.rhs.us: ; preds = %while.body.us, %for.body.us
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %while.body.us ], [ %indvars.iv, %for.body.us ]
%indvars.iv.next54 = add nsw i64 %indvars.iv53, -1
%idxprom2.us = and i64 %indvars.iv.next54, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %a, i64 %idxprom2.us
%2 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp sgt i32 %2, %1
br i1 %cmp4.us, label %while.body.us, label %while.end.us
while.end.us: ; preds = %while.body.us, %land.rhs.us
%j.0.in.lcssa.us = phi i64 [ 0, %while.body.us ], [ %indvars.iv53, %land.rhs.us ]
%sext = shl i64 %j.0.in.lcssa.us, 32
%idxprom10.us = ashr exact i64 %sext, 32
%arrayidx11.us = getelementptr inbounds i32, ptr %a, i64 %idxprom10.us
store i32 %1, ptr %arrayidx11.us, align 4, !tbaa !5
br label %for.body15.us
for.body15.us: ; preds = %while.end.us, %for.inc.us
%indvars.iv56 = phi i64 [ 0, %while.end.us ], [ %indvars.iv.next57, %for.inc.us ]
%arrayidx17.us = getelementptr inbounds i32, ptr %a, i64 %indvars.iv56
%3 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5
%call.us = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3)
%cmp19.not.us = icmp eq i64 %indvars.iv56, %0
br i1 %cmp19.not.us, label %for.inc.us, label %if.then.us
if.then.us: ; preds = %for.body15.us
%putchar44.us = tail call i32 @putchar(i32 32)
br label %for.inc.us
for.inc.us: ; preds = %if.then.us, %for.body15.us
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%exitcond.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count62
br i1 %exitcond.not, label %for.cond12.for.cond.cleanup14_crit_edge.us, label %for.body15.us, !llvm.loop !12
while.body.us: ; preds = %land.rhs.us
%arrayidx8.us = getelementptr inbounds i32, ptr %a, i64 %indvars.iv53
store i32 %2, ptr %arrayidx8.us, align 4, !tbaa !5
%4 = icmp sgt i64 %indvars.iv53, 1
br i1 %4, label %land.rhs.us, label %while.end.us, !llvm.loop !13
for.cond12.for.cond.cleanup14_crit_edge.us: ; preds = %for.inc.us
%putchar.us = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond63.not = icmp eq i64 %indvars.iv.next, %wide.trip.count62
br i1 %exitcond63.not, label %for.cond.cleanup, label %for.body.us, !llvm.loop !14
for.cond.cleanup: ; preds = %for.cond12.for.cond.cleanup14_crit_edge.us, %entry
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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
typedef struct _dice {
int label[6];
} DICE, *PDICE;
int rotation[6][5] =
{
{ /* N */ 1, 2, 6, 5},
{ /* S */ 1, 5, 6, 2},
{ /* E */ 1, 4, 6, 3},
{ /* W */ 1, 3, 6, 4},
{ /* L */ 2, 3, 5, 4},
{ /* R */ 2, 4, 5, 3}
};
int RN[] = { 'N', 'S', 'E', 'W', 'L', 'R' };
int aid(int c) {
switch (c) {
case 'N': return 0;
case 'S': return 1;
case 'E': return 2;
case 'W': return 3;
case 'L': return 4;
case 'R': return 5;
default: return -1;
}
}
void rotate(PDICE dice, int c) {
int a = aid(c);
int t, i;
if (a < 0) {
return;
}
t = dice->label[rotation[a][0] - 1];
for (i = 0; i < 3; i++) {
dice->label[rotation[a][i] - 1] =
dice->label[rotation[a][i + 1] - 1];
}
dice->label[rotation[a][3] - 1] = t;
}
void fit(PDICE dice, int p, int n) {
int i;
for (i = 0; i < 4; i++) {
if (dice->label[p] == n) {
return;
}
rotate(dice, 'N');
}
for (i = 0; i < 4; i++) {
if (dice->label[p] == n) {
return;
}
rotate(dice, 'W');
}
for (i = 0; i < 4; i++) {
if (dice->label[p] == n) {
return;
}
rotate(dice, 'L');
}
}
int matchDice(PDICE dice1, PDICE dice2) {
int i;
for (i = 0; i < 6; i++) {
if (dice1->label[i] != dice2->label[i]) {
return 0;
}
}
return -1;
}
int matchDiceTurn(DICE dice1, DICE dice2, int c) {
int i;
for (i = 0; i < 4; i++) {
if (matchDice(&dice1, &dice2)) {
return 1;
}
rotate(&dice1, c);
}
return 0;
}
int main(void) {
DICE dice1, dice2, temp;
int i;
int f = 1;
for (i = 0; i < 6; i++) {
scanf("%d", &dice1.label[i]);
}
for (i = 0; i < 6; i++) {
scanf("%d", &dice2.label[i]);
}
if (matchDiceTurn(dice1, dice2, 'L')) {
f = 0;
}
if (f) {
temp = dice1;
rotate(&temp, 'N');
rotate(&temp, 'N');
if (matchDiceTurn(temp, dice2, 'L')) {
f = 0;
}
}
if (f) {
for (i = 0; i < 4; i++) {
temp = dice1;
rotate(&temp, RN[i]);
if (matchDiceTurn(temp, dice2, 'L')) {
f = 0;
break;
}
}
}
if (!f) {
puts("Yes");
} else {
puts("No");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_116997/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_116997/source.c"
target datalayout = "e-m:e-p270: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._dice = type { [6 x i32] }
@rotation = dso_local local_unnamed_addr global [6 x [5 x i32]] [[5 x i32] [i32 1, i32 2, i32 6, i32 5, i32 0], [5 x i32] [i32 1, i32 5, i32 6, i32 2, i32 0], [5 x i32] [i32 1, i32 4, i32 6, i32 3, i32 0], [5 x i32] [i32 1, i32 3, i32 6, i32 4, i32 0], [5 x i32] [i32 2, i32 3, i32 5, i32 4, i32 0], [5 x i32] [i32 2, i32 4, i32 5, i32 3, i32 0]], align 16
@RN = dso_local local_unnamed_addr global [6 x i32] [i32 78, i32 83, i32 69, i32 87, i32 76, i32 82], align 16
@.str = private unnamed_addr constant [3 x i8] c"%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: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @aid(i32 noundef %c) local_unnamed_addr #0 {
entry:
switch i32 %c, label %sw.default [
i32 78, label %return
i32 83, label %sw.bb1
i32 69, label %sw.bb2
i32 87, label %sw.bb3
i32 76, label %sw.bb4
i32 82, label %sw.bb5
]
sw.bb1: ; preds = %entry
br label %return
sw.bb2: ; preds = %entry
br label %return
sw.bb3: ; preds = %entry
br label %return
sw.bb4: ; preds = %entry
br label %return
sw.bb5: ; preds = %entry
br label %return
sw.default: ; preds = %entry
br label %return
return: ; preds = %entry, %sw.default, %sw.bb5, %sw.bb4, %sw.bb3, %sw.bb2, %sw.bb1
%retval.0 = phi i32 [ -1, %sw.default ], [ 5, %sw.bb5 ], [ 4, %sw.bb4 ], [ 3, %sw.bb3 ], [ 2, %sw.bb2 ], [ 1, %sw.bb1 ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @rotate(ptr nocapture noundef %dice, i32 noundef %c) local_unnamed_addr #1 {
entry:
switch i32 %c, label %cleanup [
i32 78, label %if.end
i32 83, label %sw.bb1.i
i32 69, label %sw.bb2.i
i32 87, label %sw.bb3.i
i32 76, label %sw.bb4.i
i32 82, label %sw.bb5.i
]
sw.bb1.i: ; preds = %entry
br label %if.end
sw.bb2.i: ; preds = %entry
br label %if.end
sw.bb3.i: ; preds = %entry
br label %if.end
sw.bb4.i: ; preds = %entry
br label %if.end
sw.bb5.i: ; preds = %entry
br label %if.end
if.end: ; preds = %sw.bb5.i, %sw.bb4.i, %sw.bb3.i, %sw.bb2.i, %sw.bb1.i, %entry
%retval.0.i.ph = phi i64 [ 0, %entry ], [ 1, %sw.bb1.i ], [ 2, %sw.bb2.i ], [ 3, %sw.bb3.i ], [ 4, %sw.bb4.i ], [ 5, %sw.bb5.i ]
%arrayidx = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom2 = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%arrayidx9 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph, i64 1
%2 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%sub10 = add nsw i32 %2, -1
%idxprom11 = sext i32 %sub10 to i64
%arrayidx12 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11
%3 = load i32, ptr %arrayidx12, align 4, !tbaa !5
store i32 %3, ptr %arrayidx3, align 4, !tbaa !5
%arrayidx9.1 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph, i64 2
%4 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
%sub10.1 = add nsw i32 %4, -1
%idxprom11.1 = sext i32 %sub10.1 to i64
%arrayidx12.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1
%5 = load i32, ptr %arrayidx12.1, align 4, !tbaa !5
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%sub18.1 = add nsw i32 %6, -1
%idxprom19.1 = sext i32 %sub18.1 to i64
%arrayidx20.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1
store i32 %5, ptr %arrayidx20.1, align 4, !tbaa !5
%arrayidx9.2 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph, i64 3
%7 = load i32, ptr %arrayidx9.2, align 4, !tbaa !5
%sub10.2 = add nsw i32 %7, -1
%idxprom11.2 = sext i32 %sub10.2 to i64
%arrayidx12.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2
%8 = load i32, ptr %arrayidx12.2, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
%sub18.2 = add nsw i32 %9, -1
%idxprom19.2 = sext i32 %sub18.2 to i64
%arrayidx20.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2
store i32 %8, ptr %arrayidx20.2, align 4, !tbaa !5
%10 = load i32, ptr %arrayidx9.2, align 4, !tbaa !5
%sub25 = add nsw i32 %10, -1
%idxprom26 = sext i32 %sub25 to i64
%arrayidx27 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26
store i32 %1, ptr %arrayidx27, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %entry, %if.end
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: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @fit(ptr nocapture noundef %dice, i32 noundef %p, i32 noundef %n) local_unnamed_addr #1 {
entry:
%idxprom = sext i32 %p to i64
%arrayidx = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, %n
br i1 %cmp1, label %cleanup, label %if.end
if.end: ; preds = %entry
%1 = load i32, ptr @rotation, align 16, !tbaa !5
%sub.i = add nsw i32 %1, -1
%idxprom2.i = sext i32 %sub.i to i64
%arrayidx3.i = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2.i
%2 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%3 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 1), align 4, !tbaa !5
%sub10.i = add nsw i32 %3, -1
%idxprom11.i = sext i32 %sub10.i to i64
%arrayidx12.i = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.i
%4 = load i32, ptr %arrayidx12.i, align 4, !tbaa !5
store i32 %4, ptr %arrayidx3.i, align 4, !tbaa !5
%5 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 2), align 8, !tbaa !5
%sub10.1.i = add nsw i32 %5, -1
%idxprom11.1.i = sext i32 %sub10.1.i to i64
%arrayidx12.1.i = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1.i
%6 = load i32, ptr %arrayidx12.1.i, align 4, !tbaa !5
%7 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 1), align 4, !tbaa !5
%sub18.1.i = add nsw i32 %7, -1
%idxprom19.1.i = sext i32 %sub18.1.i to i64
%arrayidx20.1.i = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1.i
store i32 %6, ptr %arrayidx20.1.i, align 4, !tbaa !5
%8 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 3), align 4, !tbaa !5
%sub10.2.i = add nsw i32 %8, -1
%idxprom11.2.i = sext i32 %sub10.2.i to i64
%arrayidx12.2.i = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2.i
%9 = load i32, ptr %arrayidx12.2.i, align 4, !tbaa !5
%10 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 2), align 8, !tbaa !5
%sub18.2.i = add nsw i32 %10, -1
%idxprom19.2.i = sext i32 %sub18.2.i to i64
%arrayidx20.2.i = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2.i
store i32 %9, ptr %arrayidx20.2.i, align 4, !tbaa !5
%11 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 3), align 4, !tbaa !5
%sub25.i = add nsw i32 %11, -1
%idxprom26.i = sext i32 %sub25.i to i64
%arrayidx27.i = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26.i
store i32 %2, ptr %arrayidx27.i, align 4, !tbaa !5
%12 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1.1 = icmp eq i32 %12, %n
br i1 %cmp1.1, label %cleanup, label %if.end.1
if.end.1: ; preds = %if.end
%13 = load i32, ptr @rotation, align 16, !tbaa !5
%sub.i.1 = add nsw i32 %13, -1
%idxprom2.i.1 = sext i32 %sub.i.1 to i64
%arrayidx3.i.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2.i.1
%14 = load i32, ptr %arrayidx3.i.1, align 4, !tbaa !5
%15 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 1), align 4, !tbaa !5
%sub10.i.1 = add nsw i32 %15, -1
%idxprom11.i.1 = sext i32 %sub10.i.1 to i64
%arrayidx12.i.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.i.1
%16 = load i32, ptr %arrayidx12.i.1, align 4, !tbaa !5
store i32 %16, ptr %arrayidx3.i.1, align 4, !tbaa !5
%17 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 2), align 8, !tbaa !5
%sub10.1.i.1 = add nsw i32 %17, -1
%idxprom11.1.i.1 = sext i32 %sub10.1.i.1 to i64
%arrayidx12.1.i.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1.i.1
%18 = load i32, ptr %arrayidx12.1.i.1, align 4, !tbaa !5
%19 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 1), align 4, !tbaa !5
%sub18.1.i.1 = add nsw i32 %19, -1
%idxprom19.1.i.1 = sext i32 %sub18.1.i.1 to i64
%arrayidx20.1.i.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1.i.1
store i32 %18, ptr %arrayidx20.1.i.1, align 4, !tbaa !5
%20 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 3), align 4, !tbaa !5
%sub10.2.i.1 = add nsw i32 %20, -1
%idxprom11.2.i.1 = sext i32 %sub10.2.i.1 to i64
%arrayidx12.2.i.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2.i.1
%21 = load i32, ptr %arrayidx12.2.i.1, align 4, !tbaa !5
%22 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 2), align 8, !tbaa !5
%sub18.2.i.1 = add nsw i32 %22, -1
%idxprom19.2.i.1 = sext i32 %sub18.2.i.1 to i64
%arrayidx20.2.i.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2.i.1
store i32 %21, ptr %arrayidx20.2.i.1, align 4, !tbaa !5
%23 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 3), align 4, !tbaa !5
%sub25.i.1 = add nsw i32 %23, -1
%idxprom26.i.1 = sext i32 %sub25.i.1 to i64
%arrayidx27.i.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26.i.1
store i32 %14, ptr %arrayidx27.i.1, align 4, !tbaa !5
%24 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1.2 = icmp eq i32 %24, %n
br i1 %cmp1.2, label %cleanup, label %if.end.2
if.end.2: ; preds = %if.end.1
%25 = load i32, ptr @rotation, align 16, !tbaa !5
%sub.i.2 = add nsw i32 %25, -1
%idxprom2.i.2 = sext i32 %sub.i.2 to i64
%arrayidx3.i.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2.i.2
%26 = load i32, ptr %arrayidx3.i.2, align 4, !tbaa !5
%27 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 1), align 4, !tbaa !5
%sub10.i.2 = add nsw i32 %27, -1
%idxprom11.i.2 = sext i32 %sub10.i.2 to i64
%arrayidx12.i.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.i.2
%28 = load i32, ptr %arrayidx12.i.2, align 4, !tbaa !5
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%29 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 2), align 8, !tbaa !5
%sub10.1.i.2 = add nsw i32 %29, -1
%idxprom11.1.i.2 = sext i32 %sub10.1.i.2 to i64
%arrayidx12.1.i.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1.i.2
%30 = load i32, ptr %arrayidx12.1.i.2, align 4, !tbaa !5
%31 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 1), align 4, !tbaa !5
%sub18.1.i.2 = add nsw i32 %31, -1
%idxprom19.1.i.2 = sext i32 %sub18.1.i.2 to i64
%arrayidx20.1.i.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1.i.2
store i32 %30, ptr %arrayidx20.1.i.2, align 4, !tbaa !5
%32 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 3), align 4, !tbaa !5
%sub10.2.i.2 = add nsw i32 %32, -1
%idxprom11.2.i.2 = sext i32 %sub10.2.i.2 to i64
%arrayidx12.2.i.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2.i.2
%33 = load i32, ptr %arrayidx12.2.i.2, align 4, !tbaa !5
%34 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 2), align 8, !tbaa !5
%sub18.2.i.2 = add nsw i32 %34, -1
%idxprom19.2.i.2 = sext i32 %sub18.2.i.2 to i64
%arrayidx20.2.i.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2.i.2
store i32 %33, ptr %arrayidx20.2.i.2, align 4, !tbaa !5
%35 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 3), align 4, !tbaa !5
%sub25.i.2 = add nsw i32 %35, -1
%idxprom26.i.2 = sext i32 %sub25.i.2 to i64
%arrayidx27.i.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26.i.2
store i32 %26, ptr %arrayidx27.i.2, align 4, !tbaa !5
%36 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1.3 = icmp eq i32 %36, %n
br i1 %cmp1.3, label %cleanup, label %if.end.3
if.end.3: ; preds = %if.end.2
%37 = load i32, ptr @rotation, align 16, !tbaa !5
%sub.i.3 = add nsw i32 %37, -1
%idxprom2.i.3 = sext i32 %sub.i.3 to i64
%arrayidx3.i.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2.i.3
%38 = load i32, ptr %arrayidx3.i.3, align 4, !tbaa !5
%39 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 1), align 4, !tbaa !5
%sub10.i.3 = add nsw i32 %39, -1
%idxprom11.i.3 = sext i32 %sub10.i.3 to i64
%arrayidx12.i.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.i.3
%40 = load i32, ptr %arrayidx12.i.3, align 4, !tbaa !5
store i32 %40, ptr %arrayidx3.i.3, align 4, !tbaa !5
%41 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 2), align 8, !tbaa !5
%sub10.1.i.3 = add nsw i32 %41, -1
%idxprom11.1.i.3 = sext i32 %sub10.1.i.3 to i64
%arrayidx12.1.i.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1.i.3
%42 = load i32, ptr %arrayidx12.1.i.3, align 4, !tbaa !5
%43 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 1), align 4, !tbaa !5
%sub18.1.i.3 = add nsw i32 %43, -1
%idxprom19.1.i.3 = sext i32 %sub18.1.i.3 to i64
%arrayidx20.1.i.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1.i.3
store i32 %42, ptr %arrayidx20.1.i.3, align 4, !tbaa !5
%44 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 3), align 4, !tbaa !5
%sub10.2.i.3 = add nsw i32 %44, -1
%idxprom11.2.i.3 = sext i32 %sub10.2.i.3 to i64
%arrayidx12.2.i.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2.i.3
%45 = load i32, ptr %arrayidx12.2.i.3, align 4, !tbaa !5
%46 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 2), align 8, !tbaa !5
%sub18.2.i.3 = add nsw i32 %46, -1
%idxprom19.2.i.3 = sext i32 %sub18.2.i.3 to i64
%arrayidx20.2.i.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2.i.3
store i32 %45, ptr %arrayidx20.2.i.3, align 4, !tbaa !5
%47 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 3), align 4, !tbaa !5
%sub25.i.3 = add nsw i32 %47, -1
%idxprom26.i.3 = sext i32 %sub25.i.3 to i64
%arrayidx27.i.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26.i.3
store i32 %38, ptr %arrayidx27.i.3, align 4, !tbaa !5
%48 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp8 = icmp eq i32 %48, %n
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end.3
%49 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3), align 4, !tbaa !5
%sub.i40 = add nsw i32 %49, -1
%idxprom2.i41 = sext i32 %sub.i40 to i64
%arrayidx3.i42 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2.i41
%50 = load i32, ptr %arrayidx3.i42, align 4, !tbaa !5
%51 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 1), align 16, !tbaa !5
%sub10.i43 = add nsw i32 %51, -1
%idxprom11.i44 = sext i32 %sub10.i43 to i64
%arrayidx12.i45 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.i44
%52 = load i32, ptr %arrayidx12.i45, align 4, !tbaa !5
store i32 %52, ptr %arrayidx3.i42, align 4, !tbaa !5
%53 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 2), align 4, !tbaa !5
%sub10.1.i46 = add nsw i32 %53, -1
%idxprom11.1.i47 = sext i32 %sub10.1.i46 to i64
%arrayidx12.1.i48 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1.i47
%54 = load i32, ptr %arrayidx12.1.i48, align 4, !tbaa !5
%55 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 1), align 16, !tbaa !5
%sub18.1.i49 = add nsw i32 %55, -1
%idxprom19.1.i50 = sext i32 %sub18.1.i49 to i64
%arrayidx20.1.i51 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1.i50
store i32 %54, ptr %arrayidx20.1.i51, align 4, !tbaa !5
%56 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 3), align 8, !tbaa !5
%sub10.2.i52 = add nsw i32 %56, -1
%idxprom11.2.i53 = sext i32 %sub10.2.i52 to i64
%arrayidx12.2.i54 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2.i53
%57 = load i32, ptr %arrayidx12.2.i54, align 4, !tbaa !5
%58 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 2), align 4, !tbaa !5
%sub18.2.i55 = add nsw i32 %58, -1
%idxprom19.2.i56 = sext i32 %sub18.2.i55 to i64
%arrayidx20.2.i57 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2.i56
store i32 %57, ptr %arrayidx20.2.i57, align 4, !tbaa !5
%59 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 3), align 8, !tbaa !5
%sub25.i58 = add nsw i32 %59, -1
%idxprom26.i59 = sext i32 %sub25.i58 to i64
%arrayidx27.i60 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26.i59
store i32 %50, ptr %arrayidx27.i60, align 4, !tbaa !5
%60 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp8.1 = icmp eq i32 %60, %n
br i1 %cmp8.1, label %cleanup, label %if.end10.1
if.end10.1: ; preds = %if.end10
%61 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3), align 4, !tbaa !5
%sub.i40.1 = add nsw i32 %61, -1
%idxprom2.i41.1 = sext i32 %sub.i40.1 to i64
%arrayidx3.i42.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2.i41.1
%62 = load i32, ptr %arrayidx3.i42.1, align 4, !tbaa !5
%63 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 1), align 16, !tbaa !5
%sub10.i43.1 = add nsw i32 %63, -1
%idxprom11.i44.1 = sext i32 %sub10.i43.1 to i64
%arrayidx12.i45.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.i44.1
%64 = load i32, ptr %arrayidx12.i45.1, align 4, !tbaa !5
store i32 %64, ptr %arrayidx3.i42.1, align 4, !tbaa !5
%65 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 2), align 4, !tbaa !5
%sub10.1.i46.1 = add nsw i32 %65, -1
%idxprom11.1.i47.1 = sext i32 %sub10.1.i46.1 to i64
%arrayidx12.1.i48.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1.i47.1
%66 = load i32, ptr %arrayidx12.1.i48.1, align 4, !tbaa !5
%67 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 1), align 16, !tbaa !5
%sub18.1.i49.1 = add nsw i32 %67, -1
%idxprom19.1.i50.1 = sext i32 %sub18.1.i49.1 to i64
%arrayidx20.1.i51.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1.i50.1
store i32 %66, ptr %arrayidx20.1.i51.1, align 4, !tbaa !5
%68 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 3), align 8, !tbaa !5
%sub10.2.i52.1 = add nsw i32 %68, -1
%idxprom11.2.i53.1 = sext i32 %sub10.2.i52.1 to i64
%arrayidx12.2.i54.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2.i53.1
%69 = load i32, ptr %arrayidx12.2.i54.1, align 4, !tbaa !5
%70 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 2), align 4, !tbaa !5
%sub18.2.i55.1 = add nsw i32 %70, -1
%idxprom19.2.i56.1 = sext i32 %sub18.2.i55.1 to i64
%arrayidx20.2.i57.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2.i56.1
store i32 %69, ptr %arrayidx20.2.i57.1, align 4, !tbaa !5
%71 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 3), align 8, !tbaa !5
%sub25.i58.1 = add nsw i32 %71, -1
%idxprom26.i59.1 = sext i32 %sub25.i58.1 to i64
%arrayidx27.i60.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26.i59.1
store i32 %62, ptr %arrayidx27.i60.1, align 4, !tbaa !5
%72 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp8.2 = icmp eq i32 %72, %n
br i1 %cmp8.2, label %cleanup, label %if.end10.2
if.end10.2: ; preds = %if.end10.1
%73 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3), align 4, !tbaa !5
%sub.i40.2 = add nsw i32 %73, -1
%idxprom2.i41.2 = sext i32 %sub.i40.2 to i64
%arrayidx3.i42.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2.i41.2
%74 = load i32, ptr %arrayidx3.i42.2, align 4, !tbaa !5
%75 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 1), align 16, !tbaa !5
%sub10.i43.2 = add nsw i32 %75, -1
%idxprom11.i44.2 = sext i32 %sub10.i43.2 to i64
%arrayidx12.i45.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.i44.2
%76 = load i32, ptr %arrayidx12.i45.2, align 4, !tbaa !5
store i32 %76, ptr %arrayidx3.i42.2, align 4, !tbaa !5
%77 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 2), align 4, !tbaa !5
%sub10.1.i46.2 = add nsw i32 %77, -1
%idxprom11.1.i47.2 = sext i32 %sub10.1.i46.2 to i64
%arrayidx12.1.i48.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1.i47.2
%78 = load i32, ptr %arrayidx12.1.i48.2, align 4, !tbaa !5
%79 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 1), align 16, !tbaa !5
%sub18.1.i49.2 = add nsw i32 %79, -1
%idxprom19.1.i50.2 = sext i32 %sub18.1.i49.2 to i64
%arrayidx20.1.i51.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1.i50.2
store i32 %78, ptr %arrayidx20.1.i51.2, align 4, !tbaa !5
%80 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 3), align 8, !tbaa !5
%sub10.2.i52.2 = add nsw i32 %80, -1
%idxprom11.2.i53.2 = sext i32 %sub10.2.i52.2 to i64
%arrayidx12.2.i54.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2.i53.2
%81 = load i32, ptr %arrayidx12.2.i54.2, align 4, !tbaa !5
%82 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 2), align 4, !tbaa !5
%sub18.2.i55.2 = add nsw i32 %82, -1
%idxprom19.2.i56.2 = sext i32 %sub18.2.i55.2 to i64
%arrayidx20.2.i57.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2.i56.2
store i32 %81, ptr %arrayidx20.2.i57.2, align 4, !tbaa !5
%83 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 3), align 8, !tbaa !5
%sub25.i58.2 = add nsw i32 %83, -1
%idxprom26.i59.2 = sext i32 %sub25.i58.2 to i64
%arrayidx27.i60.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26.i59.2
store i32 %74, ptr %arrayidx27.i60.2, align 4, !tbaa !5
%84 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp8.3 = icmp eq i32 %84, %n
br i1 %cmp8.3, label %cleanup, label %if.end10.3
if.end10.3: ; preds = %if.end10.2
%85 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3), align 4, !tbaa !5
%sub.i40.3 = add nsw i32 %85, -1
%idxprom2.i41.3 = sext i32 %sub.i40.3 to i64
%arrayidx3.i42.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2.i41.3
%86 = load i32, ptr %arrayidx3.i42.3, align 4, !tbaa !5
%87 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 1), align 16, !tbaa !5
%sub10.i43.3 = add nsw i32 %87, -1
%idxprom11.i44.3 = sext i32 %sub10.i43.3 to i64
%arrayidx12.i45.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.i44.3
%88 = load i32, ptr %arrayidx12.i45.3, align 4, !tbaa !5
store i32 %88, ptr %arrayidx3.i42.3, align 4, !tbaa !5
%89 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 2), align 4, !tbaa !5
%sub10.1.i46.3 = add nsw i32 %89, -1
%idxprom11.1.i47.3 = sext i32 %sub10.1.i46.3 to i64
%arrayidx12.1.i48.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1.i47.3
%90 = load i32, ptr %arrayidx12.1.i48.3, align 4, !tbaa !5
%91 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 1), align 16, !tbaa !5
%sub18.1.i49.3 = add nsw i32 %91, -1
%idxprom19.1.i50.3 = sext i32 %sub18.1.i49.3 to i64
%arrayidx20.1.i51.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1.i50.3
store i32 %90, ptr %arrayidx20.1.i51.3, align 4, !tbaa !5
%92 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 3), align 8, !tbaa !5
%sub10.2.i52.3 = add nsw i32 %92, -1
%idxprom11.2.i53.3 = sext i32 %sub10.2.i52.3 to i64
%arrayidx12.2.i54.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2.i53.3
%93 = load i32, ptr %arrayidx12.2.i54.3, align 4, !tbaa !5
%94 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 2), align 4, !tbaa !5
%sub18.2.i55.3 = add nsw i32 %94, -1
%idxprom19.2.i56.3 = sext i32 %sub18.2.i55.3 to i64
%arrayidx20.2.i57.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2.i56.3
store i32 %93, ptr %arrayidx20.2.i57.3, align 4, !tbaa !5
%95 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 3, i64 3), align 8, !tbaa !5
%sub25.i58.3 = add nsw i32 %95, -1
%idxprom26.i59.3 = sext i32 %sub25.i58.3 to i64
%arrayidx27.i60.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26.i59.3
store i32 %86, ptr %arrayidx27.i60.3, align 4, !tbaa !5
%96 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp20 = icmp eq i32 %96, %n
br i1 %cmp20, label %cleanup, label %if.end22
if.end22: ; preds = %if.end10.3
%97 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4), align 16, !tbaa !5
%sub.i61 = add nsw i32 %97, -1
%idxprom2.i62 = sext i32 %sub.i61 to i64
%arrayidx3.i63 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2.i62
%98 = load i32, ptr %arrayidx3.i63, align 4, !tbaa !5
%99 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 1), align 4, !tbaa !5
%sub10.i64 = add nsw i32 %99, -1
%idxprom11.i65 = sext i32 %sub10.i64 to i64
%arrayidx12.i66 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.i65
%100 = load i32, ptr %arrayidx12.i66, align 4, !tbaa !5
store i32 %100, ptr %arrayidx3.i63, align 4, !tbaa !5
%101 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 2), align 8, !tbaa !5
%sub10.1.i67 = add nsw i32 %101, -1
%idxprom11.1.i68 = sext i32 %sub10.1.i67 to i64
%arrayidx12.1.i69 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1.i68
%102 = load i32, ptr %arrayidx12.1.i69, align 4, !tbaa !5
%103 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 1), align 4, !tbaa !5
%sub18.1.i70 = add nsw i32 %103, -1
%idxprom19.1.i71 = sext i32 %sub18.1.i70 to i64
%arrayidx20.1.i72 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1.i71
store i32 %102, ptr %arrayidx20.1.i72, align 4, !tbaa !5
%104 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 3), align 4, !tbaa !5
%sub10.2.i73 = add nsw i32 %104, -1
%idxprom11.2.i74 = sext i32 %sub10.2.i73 to i64
%arrayidx12.2.i75 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2.i74
%105 = load i32, ptr %arrayidx12.2.i75, align 4, !tbaa !5
%106 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 2), align 8, !tbaa !5
%sub18.2.i76 = add nsw i32 %106, -1
%idxprom19.2.i77 = sext i32 %sub18.2.i76 to i64
%arrayidx20.2.i78 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2.i77
store i32 %105, ptr %arrayidx20.2.i78, align 4, !tbaa !5
%107 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 3), align 4, !tbaa !5
%sub25.i79 = add nsw i32 %107, -1
%idxprom26.i80 = sext i32 %sub25.i79 to i64
%arrayidx27.i81 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26.i80
store i32 %98, ptr %arrayidx27.i81, align 4, !tbaa !5
%108 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp20.1 = icmp eq i32 %108, %n
br i1 %cmp20.1, label %cleanup, label %if.end22.1
if.end22.1: ; preds = %if.end22
%109 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4), align 16, !tbaa !5
%sub.i61.1 = add nsw i32 %109, -1
%idxprom2.i62.1 = sext i32 %sub.i61.1 to i64
%arrayidx3.i63.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2.i62.1
%110 = load i32, ptr %arrayidx3.i63.1, align 4, !tbaa !5
%111 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 1), align 4, !tbaa !5
%sub10.i64.1 = add nsw i32 %111, -1
%idxprom11.i65.1 = sext i32 %sub10.i64.1 to i64
%arrayidx12.i66.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.i65.1
%112 = load i32, ptr %arrayidx12.i66.1, align 4, !tbaa !5
store i32 %112, ptr %arrayidx3.i63.1, align 4, !tbaa !5
%113 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 2), align 8, !tbaa !5
%sub10.1.i67.1 = add nsw i32 %113, -1
%idxprom11.1.i68.1 = sext i32 %sub10.1.i67.1 to i64
%arrayidx12.1.i69.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1.i68.1
%114 = load i32, ptr %arrayidx12.1.i69.1, align 4, !tbaa !5
%115 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 1), align 4, !tbaa !5
%sub18.1.i70.1 = add nsw i32 %115, -1
%idxprom19.1.i71.1 = sext i32 %sub18.1.i70.1 to i64
%arrayidx20.1.i72.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1.i71.1
store i32 %114, ptr %arrayidx20.1.i72.1, align 4, !tbaa !5
%116 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 3), align 4, !tbaa !5
%sub10.2.i73.1 = add nsw i32 %116, -1
%idxprom11.2.i74.1 = sext i32 %sub10.2.i73.1 to i64
%arrayidx12.2.i75.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2.i74.1
%117 = load i32, ptr %arrayidx12.2.i75.1, align 4, !tbaa !5
%118 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 2), align 8, !tbaa !5
%sub18.2.i76.1 = add nsw i32 %118, -1
%idxprom19.2.i77.1 = sext i32 %sub18.2.i76.1 to i64
%arrayidx20.2.i78.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2.i77.1
store i32 %117, ptr %arrayidx20.2.i78.1, align 4, !tbaa !5
%119 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 3), align 4, !tbaa !5
%sub25.i79.1 = add nsw i32 %119, -1
%idxprom26.i80.1 = sext i32 %sub25.i79.1 to i64
%arrayidx27.i81.1 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26.i80.1
store i32 %110, ptr %arrayidx27.i81.1, align 4, !tbaa !5
%120 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp20.2 = icmp eq i32 %120, %n
br i1 %cmp20.2, label %cleanup, label %if.end22.2
if.end22.2: ; preds = %if.end22.1
%121 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4), align 16, !tbaa !5
%sub.i61.2 = add nsw i32 %121, -1
%idxprom2.i62.2 = sext i32 %sub.i61.2 to i64
%arrayidx3.i63.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2.i62.2
%122 = load i32, ptr %arrayidx3.i63.2, align 4, !tbaa !5
%123 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 1), align 4, !tbaa !5
%sub10.i64.2 = add nsw i32 %123, -1
%idxprom11.i65.2 = sext i32 %sub10.i64.2 to i64
%arrayidx12.i66.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.i65.2
%124 = load i32, ptr %arrayidx12.i66.2, align 4, !tbaa !5
store i32 %124, ptr %arrayidx3.i63.2, align 4, !tbaa !5
%125 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 2), align 8, !tbaa !5
%sub10.1.i67.2 = add nsw i32 %125, -1
%idxprom11.1.i68.2 = sext i32 %sub10.1.i67.2 to i64
%arrayidx12.1.i69.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1.i68.2
%126 = load i32, ptr %arrayidx12.1.i69.2, align 4, !tbaa !5
%127 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 1), align 4, !tbaa !5
%sub18.1.i70.2 = add nsw i32 %127, -1
%idxprom19.1.i71.2 = sext i32 %sub18.1.i70.2 to i64
%arrayidx20.1.i72.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1.i71.2
store i32 %126, ptr %arrayidx20.1.i72.2, align 4, !tbaa !5
%128 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 3), align 4, !tbaa !5
%sub10.2.i73.2 = add nsw i32 %128, -1
%idxprom11.2.i74.2 = sext i32 %sub10.2.i73.2 to i64
%arrayidx12.2.i75.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2.i74.2
%129 = load i32, ptr %arrayidx12.2.i75.2, align 4, !tbaa !5
%130 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 2), align 8, !tbaa !5
%sub18.2.i76.2 = add nsw i32 %130, -1
%idxprom19.2.i77.2 = sext i32 %sub18.2.i76.2 to i64
%arrayidx20.2.i78.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2.i77.2
store i32 %129, ptr %arrayidx20.2.i78.2, align 4, !tbaa !5
%131 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 3), align 4, !tbaa !5
%sub25.i79.2 = add nsw i32 %131, -1
%idxprom26.i80.2 = sext i32 %sub25.i79.2 to i64
%arrayidx27.i81.2 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26.i80.2
store i32 %122, ptr %arrayidx27.i81.2, align 4, !tbaa !5
%132 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp20.3 = icmp eq i32 %132, %n
br i1 %cmp20.3, label %cleanup, label %if.end22.3
if.end22.3: ; preds = %if.end22.2
%133 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4), align 16, !tbaa !5
%sub.i61.3 = add nsw i32 %133, -1
%idxprom2.i62.3 = sext i32 %sub.i61.3 to i64
%arrayidx3.i63.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom2.i62.3
%134 = load i32, ptr %arrayidx3.i63.3, align 4, !tbaa !5
%135 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 1), align 4, !tbaa !5
%sub10.i64.3 = add nsw i32 %135, -1
%idxprom11.i65.3 = sext i32 %sub10.i64.3 to i64
%arrayidx12.i66.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.i65.3
%136 = load i32, ptr %arrayidx12.i66.3, align 4, !tbaa !5
store i32 %136, ptr %arrayidx3.i63.3, align 4, !tbaa !5
%137 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 2), align 8, !tbaa !5
%sub10.1.i67.3 = add nsw i32 %137, -1
%idxprom11.1.i68.3 = sext i32 %sub10.1.i67.3 to i64
%arrayidx12.1.i69.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.1.i68.3
%138 = load i32, ptr %arrayidx12.1.i69.3, align 4, !tbaa !5
%139 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 1), align 4, !tbaa !5
%sub18.1.i70.3 = add nsw i32 %139, -1
%idxprom19.1.i71.3 = sext i32 %sub18.1.i70.3 to i64
%arrayidx20.1.i72.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.1.i71.3
store i32 %138, ptr %arrayidx20.1.i72.3, align 4, !tbaa !5
%140 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 3), align 4, !tbaa !5
%sub10.2.i73.3 = add nsw i32 %140, -1
%idxprom11.2.i74.3 = sext i32 %sub10.2.i73.3 to i64
%arrayidx12.2.i75.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom11.2.i74.3
%141 = load i32, ptr %arrayidx12.2.i75.3, align 4, !tbaa !5
%142 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 2), align 8, !tbaa !5
%sub18.2.i76.3 = add nsw i32 %142, -1
%idxprom19.2.i77.3 = sext i32 %sub18.2.i76.3 to i64
%arrayidx20.2.i78.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom19.2.i77.3
store i32 %141, ptr %arrayidx20.2.i78.3, align 4, !tbaa !5
%143 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 4, i64 3), align 4, !tbaa !5
%sub25.i79.3 = add nsw i32 %143, -1
%idxprom26.i80.3 = sext i32 %sub25.i79.3 to i64
%arrayidx27.i81.3 = getelementptr inbounds [6 x i32], ptr %dice, i64 0, i64 %idxprom26.i80.3
store i32 %134, ptr %arrayidx27.i81.3, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %entry, %if.end, %if.end.1, %if.end.2, %if.end.3, %if.end10, %if.end10.1, %if.end10.2, %if.end10.3, %if.end22, %if.end22.1, %if.end22.2, %if.end22.3
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @matchDice(ptr nocapture noundef readonly %dice1, ptr nocapture noundef readonly %dice2) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %dice1, align 4, !tbaa !5
%1 = load i32, ptr %dice2, align 4, !tbaa !5
%cmp4.not = icmp eq i32 %0, %1
br i1 %cmp4.not, label %for.cond, label %cleanup
for.cond: ; preds = %entry
%arrayidx.1 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 1
%2 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 1
%3 = load i32, ptr %arrayidx3.1, align 4, !tbaa !5
%cmp4.not.1 = icmp eq i32 %2, %3
br i1 %cmp4.not.1, label %for.cond.1, label %cleanup
for.cond.1: ; preds = %for.cond
%arrayidx.2 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 2
%4 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 2
%5 = load i32, ptr %arrayidx3.2, align 4, !tbaa !5
%cmp4.not.2 = icmp eq i32 %4, %5
br i1 %cmp4.not.2, label %for.cond.2, label %cleanup
for.cond.2: ; preds = %for.cond.1
%arrayidx.3 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 3
%6 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 3
%7 = load i32, ptr %arrayidx3.3, align 4, !tbaa !5
%cmp4.not.3 = icmp eq i32 %6, %7
br i1 %cmp4.not.3, label %for.cond.3, label %cleanup
for.cond.3: ; preds = %for.cond.2
%arrayidx.4 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 4
%8 = load i32, ptr %arrayidx.4, align 4, !tbaa !5
%arrayidx3.4 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 4
%9 = load i32, ptr %arrayidx3.4, align 4, !tbaa !5
%cmp4.not.4 = icmp eq i32 %8, %9
br i1 %cmp4.not.4, label %for.cond.4, label %cleanup
for.cond.4: ; preds = %for.cond.3
%arrayidx.5 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 5
%10 = load i32, ptr %arrayidx.5, align 4, !tbaa !5
%arrayidx3.5 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 5
%11 = load i32, ptr %arrayidx3.5, align 4, !tbaa !5
%cmp4.not.5 = icmp eq i32 %10, %11
%spec.select = sext i1 %cmp4.not.5 to i32
br label %cleanup
cleanup: ; preds = %for.cond.4, %for.cond.3, %for.cond.2, %for.cond.1, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 0, %for.cond.1 ], [ 0, %for.cond.2 ], [ 0, %for.cond.3 ], [ %spec.select, %for.cond.4 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @matchDiceTurn(ptr nocapture noundef byval(%struct._dice) align 8 %dice1, ptr nocapture noundef readonly byval(%struct._dice) align 8 %dice2, i32 noundef %c) local_unnamed_addr #1 {
entry:
%arrayidx.5.i = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 5
%0 = load i32, ptr %dice2, align 8, !tbaa !5
%arrayidx.1.i = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 1
%arrayidx3.1.i = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 1
%1 = load i32, ptr %arrayidx3.1.i, align 4
%arrayidx.2.i = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 2
%arrayidx3.2.i = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 2
%2 = load i32, ptr %arrayidx3.2.i, align 8
%arrayidx.3.i = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 3
%arrayidx3.3.i = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 3
%3 = load i32, ptr %arrayidx3.3.i, align 4
%arrayidx.4.i = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 4
%arrayidx3.4.i = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 4
%4 = load i32, ptr %arrayidx3.4.i, align 8
%arrayidx3.5.i = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 5
%5 = load i32, ptr %arrayidx3.5.i, align 4
%6 = load i32, ptr %dice1, align 8, !tbaa !5
%cmp4.not.i = icmp eq i32 %6, %0
%7 = load i32, ptr %arrayidx.1.i, align 4
%cmp4.not.1.i = icmp eq i32 %7, %1
%or.cond = select i1 %cmp4.not.i, i1 %cmp4.not.1.i, i1 false
%8 = load i32, ptr %arrayidx.2.i, align 8
%cmp4.not.2.i = icmp eq i32 %8, %2
%or.cond5 = select i1 %or.cond, i1 %cmp4.not.2.i, i1 false
%9 = load i32, ptr %arrayidx.3.i, align 4
%cmp4.not.3.i = icmp eq i32 %9, %3
%or.cond6 = select i1 %or.cond5, i1 %cmp4.not.3.i, i1 false
%10 = load i32, ptr %arrayidx.4.i, align 8
%cmp4.not.4.i = icmp eq i32 %10, %4
%or.cond7 = select i1 %or.cond6, i1 %cmp4.not.4.i, i1 false
%11 = load i32, ptr %arrayidx.5.i, align 4
%cmp4.not.5.i.not = icmp eq i32 %11, %5
%or.cond8 = select i1 %or.cond7, i1 %cmp4.not.5.i.not, i1 false
br i1 %or.cond8, label %cleanup, label %if.end
if.end: ; preds = %entry
switch i32 %c, label %rotate.exit [
i32 78, label %if.end.i
i32 83, label %sw.bb1.i.i
i32 69, label %sw.bb2.i.i
i32 87, label %sw.bb3.i.i
i32 76, label %sw.bb4.i.i
i32 82, label %sw.bb5.i.i
]
sw.bb1.i.i: ; preds = %if.end
br label %if.end.i
sw.bb2.i.i: ; preds = %if.end
br label %if.end.i
sw.bb3.i.i: ; preds = %if.end
br label %if.end.i
sw.bb4.i.i: ; preds = %if.end
br label %if.end.i
sw.bb5.i.i: ; preds = %if.end
br label %if.end.i
if.end.i: ; preds = %sw.bb5.i.i, %sw.bb4.i.i, %sw.bb3.i.i, %sw.bb2.i.i, %sw.bb1.i.i, %if.end
%retval.0.i.ph.i = phi i64 [ 0, %if.end ], [ 1, %sw.bb1.i.i ], [ 2, %sw.bb2.i.i ], [ 3, %sw.bb3.i.i ], [ 4, %sw.bb4.i.i ], [ 5, %sw.bb5.i.i ]
%arrayidx.i = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i
%12 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%sub.i = add nsw i32 %12, -1
%idxprom2.i = sext i32 %sub.i to i64
%arrayidx3.i = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 %idxprom2.i
%13 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%arrayidx9.i = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i, i64 1
%14 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5
%sub10.i = add nsw i32 %14, -1
%idxprom11.i = sext i32 %sub10.i to i64
%arrayidx12.i = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 %idxprom11.i
%15 = load i32, ptr %arrayidx12.i, align 4, !tbaa !5
store i32 %15, ptr %arrayidx3.i, align 4, !tbaa !5
%arrayidx9.1.i = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i, i64 2
%16 = load i32, ptr %arrayidx9.1.i, align 4, !tbaa !5
%sub10.1.i = add nsw i32 %16, -1
%idxprom11.1.i = sext i32 %sub10.1.i to i64
%arrayidx12.1.i = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 %idxprom11.1.i
%17 = load i32, ptr %arrayidx12.1.i, align 4, !tbaa !5
store i32 %17, ptr %arrayidx12.i, align 4, !tbaa !5
%arrayidx9.2.i = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i, i64 3
%18 = load i32, ptr %arrayidx9.2.i, align 4, !tbaa !5
%sub10.2.i = add nsw i32 %18, -1
%idxprom11.2.i = sext i32 %sub10.2.i to i64
%arrayidx12.2.i = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 %idxprom11.2.i
%19 = load i32, ptr %arrayidx12.2.i, align 4, !tbaa !5
store i32 %19, ptr %arrayidx12.1.i, align 4, !tbaa !5
store i32 %13, ptr %arrayidx12.2.i, align 4, !tbaa !5
%.pre = load i32, ptr %dice1, align 8, !tbaa !5
%.pre9 = load i32, ptr %arrayidx.1.i, align 4
%.pre10 = load i32, ptr %arrayidx.2.i, align 8
%.pre11 = load i32, ptr %arrayidx.3.i, align 4
%.pre12 = load i32, ptr %arrayidx.4.i, align 8
%.pre13 = load i32, ptr %arrayidx.5.i, align 4
br label %rotate.exit
rotate.exit: ; preds = %if.end, %if.end.i
%20 = phi i32 [ %11, %if.end ], [ %.pre13, %if.end.i ]
%21 = phi i32 [ %10, %if.end ], [ %.pre12, %if.end.i ]
%22 = phi i32 [ %9, %if.end ], [ %.pre11, %if.end.i ]
%23 = phi i32 [ %8, %if.end ], [ %.pre10, %if.end.i ]
%24 = phi i32 [ %7, %if.end ], [ %.pre9, %if.end.i ]
%25 = phi i32 [ %6, %if.end ], [ %.pre, %if.end.i ]
%cmp4.not.i.1 = icmp eq i32 %25, %0
%cmp4.not.1.i.1 = icmp eq i32 %24, %1
%or.cond.1 = select i1 %cmp4.not.i.1, i1 %cmp4.not.1.i.1, i1 false
%cmp4.not.2.i.1 = icmp eq i32 %23, %2
%or.cond5.1 = select i1 %or.cond.1, i1 %cmp4.not.2.i.1, i1 false
%cmp4.not.3.i.1 = icmp eq i32 %22, %3
%or.cond6.1 = select i1 %or.cond5.1, i1 %cmp4.not.3.i.1, i1 false
%cmp4.not.4.i.1 = icmp eq i32 %21, %4
%or.cond7.1 = select i1 %or.cond6.1, i1 %cmp4.not.4.i.1, i1 false
%cmp4.not.5.i.not.1 = icmp eq i32 %20, %5
%or.cond8.1 = select i1 %or.cond7.1, i1 %cmp4.not.5.i.not.1, i1 false
br i1 %or.cond8.1, label %cleanup, label %if.end.1
if.end.1: ; preds = %rotate.exit
switch i32 %c, label %rotate.exit.1 [
i32 78, label %if.end.i.1
i32 83, label %sw.bb1.i.i.1
i32 69, label %sw.bb2.i.i.1
i32 87, label %sw.bb3.i.i.1
i32 76, label %sw.bb4.i.i.1
i32 82, label %sw.bb5.i.i.1
]
sw.bb5.i.i.1: ; preds = %if.end.1
br label %if.end.i.1
sw.bb4.i.i.1: ; preds = %if.end.1
br label %if.end.i.1
sw.bb3.i.i.1: ; preds = %if.end.1
br label %if.end.i.1
sw.bb2.i.i.1: ; preds = %if.end.1
br label %if.end.i.1
sw.bb1.i.i.1: ; preds = %if.end.1
br label %if.end.i.1
if.end.i.1: ; preds = %sw.bb1.i.i.1, %sw.bb2.i.i.1, %sw.bb3.i.i.1, %sw.bb4.i.i.1, %sw.bb5.i.i.1, %if.end.1
%retval.0.i.ph.i.1 = phi i64 [ 0, %if.end.1 ], [ 1, %sw.bb1.i.i.1 ], [ 2, %sw.bb2.i.i.1 ], [ 3, %sw.bb3.i.i.1 ], [ 4, %sw.bb4.i.i.1 ], [ 5, %sw.bb5.i.i.1 ]
%arrayidx.i.1 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.1
%26 = load i32, ptr %arrayidx.i.1, align 4, !tbaa !5
%sub.i.1 = add nsw i32 %26, -1
%idxprom2.i.1 = sext i32 %sub.i.1 to i64
%arrayidx3.i.1 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 %idxprom2.i.1
%27 = load i32, ptr %arrayidx3.i.1, align 4, !tbaa !5
%arrayidx9.i.1 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.1, i64 1
%28 = load i32, ptr %arrayidx9.i.1, align 4, !tbaa !5
%sub10.i.1 = add nsw i32 %28, -1
%idxprom11.i.1 = sext i32 %sub10.i.1 to i64
%arrayidx12.i.1 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 %idxprom11.i.1
%29 = load i32, ptr %arrayidx12.i.1, align 4, !tbaa !5
store i32 %29, ptr %arrayidx3.i.1, align 4, !tbaa !5
%arrayidx9.1.i.1 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.1, i64 2
%30 = load i32, ptr %arrayidx9.1.i.1, align 4, !tbaa !5
%sub10.1.i.1 = add nsw i32 %30, -1
%idxprom11.1.i.1 = sext i32 %sub10.1.i.1 to i64
%arrayidx12.1.i.1 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 %idxprom11.1.i.1
%31 = load i32, ptr %arrayidx12.1.i.1, align 4, !tbaa !5
store i32 %31, ptr %arrayidx12.i.1, align 4, !tbaa !5
%arrayidx9.2.i.1 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.1, i64 3
%32 = load i32, ptr %arrayidx9.2.i.1, align 4, !tbaa !5
%sub10.2.i.1 = add nsw i32 %32, -1
%idxprom11.2.i.1 = sext i32 %sub10.2.i.1 to i64
%arrayidx12.2.i.1 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 %idxprom11.2.i.1
%33 = load i32, ptr %arrayidx12.2.i.1, align 4, !tbaa !5
store i32 %33, ptr %arrayidx12.1.i.1, align 4, !tbaa !5
store i32 %27, ptr %arrayidx12.2.i.1, align 4, !tbaa !5
%.pre14 = load i32, ptr %dice1, align 8, !tbaa !5
%.pre15 = load i32, ptr %arrayidx.1.i, align 4
%.pre16 = load i32, ptr %arrayidx.2.i, align 8
%.pre17 = load i32, ptr %arrayidx.3.i, align 4
%.pre18 = load i32, ptr %arrayidx.4.i, align 8
%.pre19 = load i32, ptr %arrayidx.5.i, align 4
br label %rotate.exit.1
rotate.exit.1: ; preds = %if.end.i.1, %if.end.1
%34 = phi i32 [ %.pre19, %if.end.i.1 ], [ %20, %if.end.1 ]
%35 = phi i32 [ %.pre18, %if.end.i.1 ], [ %21, %if.end.1 ]
%36 = phi i32 [ %.pre17, %if.end.i.1 ], [ %22, %if.end.1 ]
%37 = phi i32 [ %.pre16, %if.end.i.1 ], [ %23, %if.end.1 ]
%38 = phi i32 [ %.pre15, %if.end.i.1 ], [ %24, %if.end.1 ]
%39 = phi i32 [ %.pre14, %if.end.i.1 ], [ %25, %if.end.1 ]
%cmp4.not.i.2 = icmp eq i32 %39, %0
%cmp4.not.1.i.2 = icmp eq i32 %38, %1
%or.cond.2 = select i1 %cmp4.not.i.2, i1 %cmp4.not.1.i.2, i1 false
%cmp4.not.2.i.2 = icmp eq i32 %37, %2
%or.cond5.2 = select i1 %or.cond.2, i1 %cmp4.not.2.i.2, i1 false
%cmp4.not.3.i.2 = icmp eq i32 %36, %3
%or.cond6.2 = select i1 %or.cond5.2, i1 %cmp4.not.3.i.2, i1 false
%cmp4.not.4.i.2 = icmp eq i32 %35, %4
%or.cond7.2 = select i1 %or.cond6.2, i1 %cmp4.not.4.i.2, i1 false
%cmp4.not.5.i.not.2 = icmp eq i32 %34, %5
%or.cond8.2 = select i1 %or.cond7.2, i1 %cmp4.not.5.i.not.2, i1 false
br i1 %or.cond8.2, label %cleanup, label %if.end.2
if.end.2: ; preds = %rotate.exit.1
switch i32 %c, label %rotate.exit.2 [
i32 78, label %if.end.i.2
i32 83, label %sw.bb1.i.i.2
i32 69, label %sw.bb2.i.i.2
i32 87, label %sw.bb3.i.i.2
i32 76, label %sw.bb4.i.i.2
i32 82, label %sw.bb5.i.i.2
]
sw.bb5.i.i.2: ; preds = %if.end.2
br label %if.end.i.2
sw.bb4.i.i.2: ; preds = %if.end.2
br label %if.end.i.2
sw.bb3.i.i.2: ; preds = %if.end.2
br label %if.end.i.2
sw.bb2.i.i.2: ; preds = %if.end.2
br label %if.end.i.2
sw.bb1.i.i.2: ; preds = %if.end.2
br label %if.end.i.2
if.end.i.2: ; preds = %sw.bb1.i.i.2, %sw.bb2.i.i.2, %sw.bb3.i.i.2, %sw.bb4.i.i.2, %sw.bb5.i.i.2, %if.end.2
%retval.0.i.ph.i.2 = phi i64 [ 0, %if.end.2 ], [ 1, %sw.bb1.i.i.2 ], [ 2, %sw.bb2.i.i.2 ], [ 3, %sw.bb3.i.i.2 ], [ 4, %sw.bb4.i.i.2 ], [ 5, %sw.bb5.i.i.2 ]
%arrayidx.i.2 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.2
%40 = load i32, ptr %arrayidx.i.2, align 4, !tbaa !5
%sub.i.2 = add nsw i32 %40, -1
%idxprom2.i.2 = sext i32 %sub.i.2 to i64
%arrayidx3.i.2 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 %idxprom2.i.2
%41 = load i32, ptr %arrayidx3.i.2, align 4, !tbaa !5
%arrayidx9.i.2 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.2, i64 1
%42 = load i32, ptr %arrayidx9.i.2, align 4, !tbaa !5
%sub10.i.2 = add nsw i32 %42, -1
%idxprom11.i.2 = sext i32 %sub10.i.2 to i64
%arrayidx12.i.2 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 %idxprom11.i.2
%43 = load i32, ptr %arrayidx12.i.2, align 4, !tbaa !5
store i32 %43, ptr %arrayidx3.i.2, align 4, !tbaa !5
%arrayidx9.1.i.2 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.2, i64 2
%44 = load i32, ptr %arrayidx9.1.i.2, align 4, !tbaa !5
%sub10.1.i.2 = add nsw i32 %44, -1
%idxprom11.1.i.2 = sext i32 %sub10.1.i.2 to i64
%arrayidx12.1.i.2 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 %idxprom11.1.i.2
%45 = load i32, ptr %arrayidx12.1.i.2, align 4, !tbaa !5
store i32 %45, ptr %arrayidx12.i.2, align 4, !tbaa !5
%arrayidx9.2.i.2 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.2, i64 3
%46 = load i32, ptr %arrayidx9.2.i.2, align 4, !tbaa !5
%sub10.2.i.2 = add nsw i32 %46, -1
%idxprom11.2.i.2 = sext i32 %sub10.2.i.2 to i64
%arrayidx12.2.i.2 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 %idxprom11.2.i.2
%47 = load i32, ptr %arrayidx12.2.i.2, align 4, !tbaa !5
store i32 %47, ptr %arrayidx12.1.i.2, align 4, !tbaa !5
store i32 %41, ptr %arrayidx12.2.i.2, align 4, !tbaa !5
%.pre20 = load i32, ptr %dice1, align 8, !tbaa !5
%.pre21 = load i32, ptr %arrayidx.1.i, align 4
%.pre22 = load i32, ptr %arrayidx.2.i, align 8
%.pre23 = load i32, ptr %arrayidx.3.i, align 4
%.pre24 = load i32, ptr %arrayidx.4.i, align 8
%.pre25 = load i32, ptr %arrayidx.5.i, align 4
br label %rotate.exit.2
rotate.exit.2: ; preds = %if.end.i.2, %if.end.2
%48 = phi i32 [ %.pre25, %if.end.i.2 ], [ %34, %if.end.2 ]
%49 = phi i32 [ %.pre24, %if.end.i.2 ], [ %35, %if.end.2 ]
%50 = phi i32 [ %.pre23, %if.end.i.2 ], [ %36, %if.end.2 ]
%51 = phi i32 [ %.pre22, %if.end.i.2 ], [ %37, %if.end.2 ]
%52 = phi i32 [ %.pre21, %if.end.i.2 ], [ %38, %if.end.2 ]
%53 = phi i32 [ %.pre20, %if.end.i.2 ], [ %39, %if.end.2 ]
%cmp4.not.i.3 = icmp eq i32 %53, %0
%cmp4.not.1.i.3 = icmp eq i32 %52, %1
%or.cond.3 = select i1 %cmp4.not.i.3, i1 %cmp4.not.1.i.3, i1 false
%cmp4.not.2.i.3 = icmp eq i32 %51, %2
%or.cond5.3 = select i1 %or.cond.3, i1 %cmp4.not.2.i.3, i1 false
%cmp4.not.3.i.3 = icmp eq i32 %50, %3
%or.cond6.3 = select i1 %or.cond5.3, i1 %cmp4.not.3.i.3, i1 false
%cmp4.not.4.i.3 = icmp eq i32 %49, %4
%or.cond7.3 = select i1 %or.cond6.3, i1 %cmp4.not.4.i.3, i1 false
%cmp4.not.5.i.not.3 = icmp eq i32 %48, %5
%or.cond8.3 = select i1 %or.cond7.3, i1 %cmp4.not.5.i.not.3, i1 false
%spec.select = zext i1 %or.cond8.3 to i32
br label %cleanup
cleanup: ; preds = %rotate.exit.2, %rotate.exit.1, %rotate.exit, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %rotate.exit ], [ 1, %rotate.exit.1 ], [ %spec.select, %rotate.exit.2 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%dice1 = alloca %struct._dice, align 8
%dice2 = alloca %struct._dice, align 8
%temp = alloca %struct._dice, align 8
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %dice1) #7
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %dice2) #7
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %temp) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %dice1)
%arrayidx.1 = getelementptr inbounds [6 x i32], ptr %dice1, 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 %dice1, 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 %dice1, 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 %dice1, 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 %dice1, i64 0, i64 5
%call.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.5)
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %dice2)
%arrayidx6.1 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 1
%call7.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.1)
%arrayidx6.2 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 2
%call7.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.2)
%arrayidx6.3 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 3
%call7.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.3)
%arrayidx6.4 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 4
%call7.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.4)
%arrayidx6.5 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 5
%call7.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.5)
%call11 = call i32 @matchDiceTurn(ptr noundef nonnull byval(%struct._dice) align 8 %dice1, ptr noundef nonnull byval(%struct._dice) align 8 %dice2, i32 noundef 76), !range !9
%tobool.not.not = icmp eq i32 %call11, 0
br i1 %tobool.not.not, label %if.then13, label %if.then35
if.then13: ; preds = %entry
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %temp, ptr noundef nonnull align 8 dereferenceable(24) %dice1, i64 24, i1 false), !tbaa.struct !10
%0 = load i32, ptr @rotation, align 16, !tbaa !5
%sub.i = add nsw i32 %0, -1
%idxprom2.i = sext i32 %sub.i to i64
%arrayidx3.i = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom2.i
%1 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%2 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 1), align 4, !tbaa !5
%sub10.i = add nsw i32 %2, -1
%idxprom11.i = sext i32 %sub10.i to i64
%arrayidx12.i = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.i
%3 = load i32, ptr %arrayidx12.i, align 4, !tbaa !5
store i32 %3, ptr %arrayidx3.i, align 4, !tbaa !5
%4 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 2), align 8, !tbaa !5
%sub10.1.i = add nsw i32 %4, -1
%idxprom11.1.i = sext i32 %sub10.1.i to i64
%arrayidx12.1.i = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.1.i
%5 = load i32, ptr %arrayidx12.1.i, align 4, !tbaa !5
store i32 %5, ptr %arrayidx12.i, align 4, !tbaa !5
%6 = load i32, ptr getelementptr inbounds ([6 x [5 x i32]], ptr @rotation, i64 0, i64 0, i64 3), align 4, !tbaa !5
%sub10.2.i = add nsw i32 %6, -1
%idxprom11.2.i = sext i32 %sub10.2.i to i64
%arrayidx12.2.i = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.2.i
%7 = load i32, ptr %arrayidx12.2.i, align 4, !tbaa !5
store i32 %7, ptr %arrayidx12.1.i, align 4, !tbaa !5
store i32 %1, ptr %arrayidx12.2.i, align 4, !tbaa !5
%8 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx12.i, align 4, !tbaa !5
store i32 %9, ptr %arrayidx3.i, align 4, !tbaa !5
%10 = load i32, ptr %arrayidx12.1.i, align 4, !tbaa !5
store i32 %10, ptr %arrayidx12.i, align 4, !tbaa !5
%11 = load i32, ptr %arrayidx12.2.i, align 4, !tbaa !5
store i32 %11, ptr %arrayidx12.1.i, align 4, !tbaa !5
store i32 %8, ptr %arrayidx12.2.i, align 4, !tbaa !5
%call14 = call i32 @matchDiceTurn(ptr noundef nonnull byval(%struct._dice) align 8 %temp, ptr noundef nonnull byval(%struct._dice) align 8 %dice2, i32 noundef 76), !range !9
%tobool15.not.not = icmp eq i32 %call14, 0
br i1 %tobool15.not.not, label %for.body23.preheader, label %if.then35
for.body23.preheader: ; preds = %if.then13
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %temp, ptr noundef nonnull align 8 dereferenceable(24) %dice1, i64 24, i1 false), !tbaa.struct !10
%12 = load i32, ptr @RN, align 16, !tbaa !5
switch i32 %12, label %rotate.exit [
i32 78, label %if.end.i
i32 83, label %sw.bb1.i.i
i32 69, label %sw.bb2.i.i
i32 87, label %sw.bb3.i.i
i32 76, label %sw.bb4.i.i
i32 82, label %sw.bb5.i.i
]
for.cond21: ; preds = %rotate.exit
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %temp, ptr noundef nonnull align 8 dereferenceable(24) %dice1, i64 24, i1 false), !tbaa.struct !10
%13 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @RN, i64 0, i64 1), align 4, !tbaa !5
switch i32 %13, label %rotate.exit.1 [
i32 78, label %if.end.i.1
i32 83, label %sw.bb1.i.i.1
i32 69, label %sw.bb2.i.i.1
i32 87, label %sw.bb3.i.i.1
i32 76, label %sw.bb4.i.i.1
i32 82, label %sw.bb5.i.i.1
]
sw.bb5.i.i.1: ; preds = %for.cond21
br label %if.end.i.1
sw.bb4.i.i.1: ; preds = %for.cond21
br label %if.end.i.1
sw.bb3.i.i.1: ; preds = %for.cond21
br label %if.end.i.1
sw.bb2.i.i.1: ; preds = %for.cond21
br label %if.end.i.1
sw.bb1.i.i.1: ; preds = %for.cond21
br label %if.end.i.1
if.end.i.1: ; preds = %sw.bb1.i.i.1, %sw.bb2.i.i.1, %sw.bb3.i.i.1, %sw.bb4.i.i.1, %sw.bb5.i.i.1, %for.cond21
%retval.0.i.ph.i.1 = phi i64 [ 0, %for.cond21 ], [ 1, %sw.bb1.i.i.1 ], [ 2, %sw.bb2.i.i.1 ], [ 3, %sw.bb3.i.i.1 ], [ 4, %sw.bb4.i.i.1 ], [ 5, %sw.bb5.i.i.1 ]
%arrayidx.i.1 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.1
%14 = load i32, ptr %arrayidx.i.1, align 4, !tbaa !5
%sub.i70.1 = add nsw i32 %14, -1
%idxprom2.i71.1 = sext i32 %sub.i70.1 to i64
%arrayidx3.i72.1 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom2.i71.1
%15 = load i32, ptr %arrayidx3.i72.1, align 4, !tbaa !5
%arrayidx9.i.1 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.1, i64 1
%16 = load i32, ptr %arrayidx9.i.1, align 4, !tbaa !5
%sub10.i73.1 = add nsw i32 %16, -1
%idxprom11.i74.1 = sext i32 %sub10.i73.1 to i64
%arrayidx12.i75.1 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.i74.1
%17 = load i32, ptr %arrayidx12.i75.1, align 4, !tbaa !5
store i32 %17, ptr %arrayidx3.i72.1, align 4, !tbaa !5
%arrayidx9.1.i.1 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.1, i64 2
%18 = load i32, ptr %arrayidx9.1.i.1, align 4, !tbaa !5
%sub10.1.i76.1 = add nsw i32 %18, -1
%idxprom11.1.i77.1 = sext i32 %sub10.1.i76.1 to i64
%arrayidx12.1.i78.1 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.1.i77.1
%19 = load i32, ptr %arrayidx12.1.i78.1, align 4, !tbaa !5
store i32 %19, ptr %arrayidx12.i75.1, align 4, !tbaa !5
%arrayidx9.2.i.1 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.1, i64 3
%20 = load i32, ptr %arrayidx9.2.i.1, align 4, !tbaa !5
%sub10.2.i82.1 = add nsw i32 %20, -1
%idxprom11.2.i83.1 = sext i32 %sub10.2.i82.1 to i64
%arrayidx12.2.i84.1 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.2.i83.1
%21 = load i32, ptr %arrayidx12.2.i84.1, align 4, !tbaa !5
store i32 %21, ptr %arrayidx12.1.i78.1, align 4, !tbaa !5
store i32 %15, ptr %arrayidx12.2.i84.1, align 4, !tbaa !5
br label %rotate.exit.1
rotate.exit.1: ; preds = %if.end.i.1, %for.cond21
%call26.1 = call i32 @matchDiceTurn(ptr noundef nonnull byval(%struct._dice) align 8 %temp, ptr noundef nonnull byval(%struct._dice) align 8 %dice2, i32 noundef 76), !range !9
%tobool27.not.1 = icmp eq i32 %call26.1, 0
br i1 %tobool27.not.1, label %for.cond21.1, label %if.then35
for.cond21.1: ; preds = %rotate.exit.1
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %temp, ptr noundef nonnull align 8 dereferenceable(24) %dice1, i64 24, i1 false), !tbaa.struct !10
%22 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @RN, i64 0, i64 2), align 8, !tbaa !5
switch i32 %22, label %rotate.exit.2 [
i32 78, label %if.end.i.2
i32 83, label %sw.bb1.i.i.2
i32 69, label %sw.bb2.i.i.2
i32 87, label %sw.bb3.i.i.2
i32 76, label %sw.bb4.i.i.2
i32 82, label %sw.bb5.i.i.2
]
sw.bb5.i.i.2: ; preds = %for.cond21.1
br label %if.end.i.2
sw.bb4.i.i.2: ; preds = %for.cond21.1
br label %if.end.i.2
sw.bb3.i.i.2: ; preds = %for.cond21.1
br label %if.end.i.2
sw.bb2.i.i.2: ; preds = %for.cond21.1
br label %if.end.i.2
sw.bb1.i.i.2: ; preds = %for.cond21.1
br label %if.end.i.2
if.end.i.2: ; preds = %sw.bb1.i.i.2, %sw.bb2.i.i.2, %sw.bb3.i.i.2, %sw.bb4.i.i.2, %sw.bb5.i.i.2, %for.cond21.1
%retval.0.i.ph.i.2 = phi i64 [ 0, %for.cond21.1 ], [ 1, %sw.bb1.i.i.2 ], [ 2, %sw.bb2.i.i.2 ], [ 3, %sw.bb3.i.i.2 ], [ 4, %sw.bb4.i.i.2 ], [ 5, %sw.bb5.i.i.2 ]
%arrayidx.i.2 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.2
%23 = load i32, ptr %arrayidx.i.2, align 4, !tbaa !5
%sub.i70.2 = add nsw i32 %23, -1
%idxprom2.i71.2 = sext i32 %sub.i70.2 to i64
%arrayidx3.i72.2 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom2.i71.2
%24 = load i32, ptr %arrayidx3.i72.2, align 4, !tbaa !5
%arrayidx9.i.2 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.2, i64 1
%25 = load i32, ptr %arrayidx9.i.2, align 4, !tbaa !5
%sub10.i73.2 = add nsw i32 %25, -1
%idxprom11.i74.2 = sext i32 %sub10.i73.2 to i64
%arrayidx12.i75.2 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.i74.2
%26 = load i32, ptr %arrayidx12.i75.2, align 4, !tbaa !5
store i32 %26, ptr %arrayidx3.i72.2, align 4, !tbaa !5
%arrayidx9.1.i.2 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.2, i64 2
%27 = load i32, ptr %arrayidx9.1.i.2, align 4, !tbaa !5
%sub10.1.i76.2 = add nsw i32 %27, -1
%idxprom11.1.i77.2 = sext i32 %sub10.1.i76.2 to i64
%arrayidx12.1.i78.2 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.1.i77.2
%28 = load i32, ptr %arrayidx12.1.i78.2, align 4, !tbaa !5
store i32 %28, ptr %arrayidx12.i75.2, align 4, !tbaa !5
%arrayidx9.2.i.2 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.2, i64 3
%29 = load i32, ptr %arrayidx9.2.i.2, align 4, !tbaa !5
%sub10.2.i82.2 = add nsw i32 %29, -1
%idxprom11.2.i83.2 = sext i32 %sub10.2.i82.2 to i64
%arrayidx12.2.i84.2 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.2.i83.2
%30 = load i32, ptr %arrayidx12.2.i84.2, align 4, !tbaa !5
store i32 %30, ptr %arrayidx12.1.i78.2, align 4, !tbaa !5
store i32 %24, ptr %arrayidx12.2.i84.2, align 4, !tbaa !5
br label %rotate.exit.2
rotate.exit.2: ; preds = %if.end.i.2, %for.cond21.1
%call26.2 = call i32 @matchDiceTurn(ptr noundef nonnull byval(%struct._dice) align 8 %temp, ptr noundef nonnull byval(%struct._dice) align 8 %dice2, i32 noundef 76), !range !9
%tobool27.not.2 = icmp eq i32 %call26.2, 0
br i1 %tobool27.not.2, label %for.cond21.2, label %if.then35
for.cond21.2: ; preds = %rotate.exit.2
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %temp, ptr noundef nonnull align 8 dereferenceable(24) %dice1, i64 24, i1 false), !tbaa.struct !10
%31 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @RN, i64 0, i64 3), align 4, !tbaa !5
switch i32 %31, label %rotate.exit.3 [
i32 78, label %if.end.i.3
i32 83, label %sw.bb1.i.i.3
i32 69, label %sw.bb2.i.i.3
i32 87, label %sw.bb3.i.i.3
i32 76, label %sw.bb4.i.i.3
i32 82, label %sw.bb5.i.i.3
]
sw.bb5.i.i.3: ; preds = %for.cond21.2
br label %if.end.i.3
sw.bb4.i.i.3: ; preds = %for.cond21.2
br label %if.end.i.3
sw.bb3.i.i.3: ; preds = %for.cond21.2
br label %if.end.i.3
sw.bb2.i.i.3: ; preds = %for.cond21.2
br label %if.end.i.3
sw.bb1.i.i.3: ; preds = %for.cond21.2
br label %if.end.i.3
if.end.i.3: ; preds = %sw.bb1.i.i.3, %sw.bb2.i.i.3, %sw.bb3.i.i.3, %sw.bb4.i.i.3, %sw.bb5.i.i.3, %for.cond21.2
%retval.0.i.ph.i.3 = phi i64 [ 0, %for.cond21.2 ], [ 1, %sw.bb1.i.i.3 ], [ 2, %sw.bb2.i.i.3 ], [ 3, %sw.bb3.i.i.3 ], [ 4, %sw.bb4.i.i.3 ], [ 5, %sw.bb5.i.i.3 ]
%arrayidx.i.3 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.3
%32 = load i32, ptr %arrayidx.i.3, align 4, !tbaa !5
%sub.i70.3 = add nsw i32 %32, -1
%idxprom2.i71.3 = sext i32 %sub.i70.3 to i64
%arrayidx3.i72.3 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom2.i71.3
%33 = load i32, ptr %arrayidx3.i72.3, align 4, !tbaa !5
%arrayidx9.i.3 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.3, i64 1
%34 = load i32, ptr %arrayidx9.i.3, align 4, !tbaa !5
%sub10.i73.3 = add nsw i32 %34, -1
%idxprom11.i74.3 = sext i32 %sub10.i73.3 to i64
%arrayidx12.i75.3 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.i74.3
%35 = load i32, ptr %arrayidx12.i75.3, align 4, !tbaa !5
store i32 %35, ptr %arrayidx3.i72.3, align 4, !tbaa !5
%arrayidx9.1.i.3 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.3, i64 2
%36 = load i32, ptr %arrayidx9.1.i.3, align 4, !tbaa !5
%sub10.1.i76.3 = add nsw i32 %36, -1
%idxprom11.1.i77.3 = sext i32 %sub10.1.i76.3 to i64
%arrayidx12.1.i78.3 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.1.i77.3
%37 = load i32, ptr %arrayidx12.1.i78.3, align 4, !tbaa !5
store i32 %37, ptr %arrayidx12.i75.3, align 4, !tbaa !5
%arrayidx9.2.i.3 = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i.3, i64 3
%38 = load i32, ptr %arrayidx9.2.i.3, align 4, !tbaa !5
%sub10.2.i82.3 = add nsw i32 %38, -1
%idxprom11.2.i83.3 = sext i32 %sub10.2.i82.3 to i64
%arrayidx12.2.i84.3 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.2.i83.3
%39 = load i32, ptr %arrayidx12.2.i84.3, align 4, !tbaa !5
store i32 %39, ptr %arrayidx12.1.i78.3, align 4, !tbaa !5
store i32 %33, ptr %arrayidx12.2.i84.3, align 4, !tbaa !5
br label %rotate.exit.3
rotate.exit.3: ; preds = %if.end.i.3, %for.cond21.2
%call26.3 = call i32 @matchDiceTurn(ptr noundef nonnull byval(%struct._dice) align 8 %temp, ptr noundef nonnull byval(%struct._dice) align 8 %dice2, i32 noundef 76), !range !9
%tobool27.not.3 = icmp eq i32 %call26.3, 0
br i1 %tobool27.not.3, label %if.end38, label %if.then35
sw.bb1.i.i: ; preds = %for.body23.preheader
br label %if.end.i
sw.bb2.i.i: ; preds = %for.body23.preheader
br label %if.end.i
sw.bb3.i.i: ; preds = %for.body23.preheader
br label %if.end.i
sw.bb4.i.i: ; preds = %for.body23.preheader
br label %if.end.i
sw.bb5.i.i: ; preds = %for.body23.preheader
br label %if.end.i
if.end.i: ; preds = %sw.bb5.i.i, %sw.bb4.i.i, %sw.bb3.i.i, %sw.bb2.i.i, %sw.bb1.i.i, %for.body23.preheader
%retval.0.i.ph.i = phi i64 [ 0, %for.body23.preheader ], [ 1, %sw.bb1.i.i ], [ 2, %sw.bb2.i.i ], [ 3, %sw.bb3.i.i ], [ 4, %sw.bb4.i.i ], [ 5, %sw.bb5.i.i ]
%arrayidx.i = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i
%40 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%sub.i70 = add nsw i32 %40, -1
%idxprom2.i71 = sext i32 %sub.i70 to i64
%arrayidx3.i72 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom2.i71
%41 = load i32, ptr %arrayidx3.i72, align 4, !tbaa !5
%arrayidx9.i = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i, i64 1
%42 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5
%sub10.i73 = add nsw i32 %42, -1
%idxprom11.i74 = sext i32 %sub10.i73 to i64
%arrayidx12.i75 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.i74
%43 = load i32, ptr %arrayidx12.i75, align 4, !tbaa !5
store i32 %43, ptr %arrayidx3.i72, align 4, !tbaa !5
%arrayidx9.1.i = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i, i64 2
%44 = load i32, ptr %arrayidx9.1.i, align 4, !tbaa !5
%sub10.1.i76 = add nsw i32 %44, -1
%idxprom11.1.i77 = sext i32 %sub10.1.i76 to i64
%arrayidx12.1.i78 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.1.i77
%45 = load i32, ptr %arrayidx12.1.i78, align 4, !tbaa !5
store i32 %45, ptr %arrayidx12.i75, align 4, !tbaa !5
%arrayidx9.2.i = getelementptr inbounds [6 x [5 x i32]], ptr @rotation, i64 0, i64 %retval.0.i.ph.i, i64 3
%46 = load i32, ptr %arrayidx9.2.i, align 4, !tbaa !5
%sub10.2.i82 = add nsw i32 %46, -1
%idxprom11.2.i83 = sext i32 %sub10.2.i82 to i64
%arrayidx12.2.i84 = getelementptr inbounds [6 x i32], ptr %temp, i64 0, i64 %idxprom11.2.i83
%47 = load i32, ptr %arrayidx12.2.i84, align 4, !tbaa !5
store i32 %47, ptr %arrayidx12.1.i78, align 4, !tbaa !5
store i32 %41, ptr %arrayidx12.2.i84, align 4, !tbaa !5
br label %rotate.exit
rotate.exit: ; preds = %for.body23.preheader, %if.end.i
%call26 = call i32 @matchDiceTurn(ptr noundef nonnull byval(%struct._dice) align 8 %temp, ptr noundef nonnull byval(%struct._dice) align 8 %dice2, i32 noundef 76), !range !9
%tobool27.not = icmp eq i32 %call26, 0
br i1 %tobool27.not, label %for.cond21, label %if.then35
if.then35: ; preds = %rotate.exit, %rotate.exit.1, %rotate.exit.2, %rotate.exit.3, %if.then13, %entry
br label %if.end38
if.end38: ; preds = %rotate.exit.3, %if.then35
%.str.2.sink = phi ptr [ @.str.1, %if.then35 ], [ @.str.2, %rotate.exit.3 ]
%call37 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %temp) #7
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %dice2) #7
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %dice1) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{i32 0, i32 2}
!10 = !{i64 0, i64 24, !11}
!11 = !{!7, !7, i64 0}
|
#include<stdio.h>
int main(void)
{
int pips[6],pips2[6],dice[6][6] = {{10,2,4,1,3,10},{3,10,0,5,10,2},{1,5,10,10,0,4},{4,0,10,10,5,1},{2,10,5,0,10,3},{10,3,1,4,2,10}};
int i,j,top,front,right;
for(i = 0;i < 6;i++){
scanf("%d",&pips[i]);
}
for(i = 0;i < 6;i++){
scanf("%d",&pips2[i]);
}
for(i = 0;i < 6;i++){
if(pips[i] == pips2[0] && pips[5 - i] == pips2[5])top = i;
if(pips[i] == pips2[1] && pips[5 - i] == pips2[4])front = i;
}
right = dice[top][front];
j = 0;
if(right != 10)j++;
if(pips[right] == pips2[2])j++;
if(pips[5 - right] == pips2[3])j++;
if(pips[5 - front] == pips2[4])j++;
if(pips[5 - top] == pips2[5])j++;
if(j == 5){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117039/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117039/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@__const.main.dice = private unnamed_addr constant [6 x [6 x i32]] [[6 x i32] [i32 10, i32 2, i32 4, i32 1, i32 3, i32 10], [6 x i32] [i32 3, i32 10, i32 0, i32 5, i32 10, i32 2], [6 x i32] [i32 1, i32 5, i32 10, i32 10, i32 0, i32 4], [6 x i32] [i32 4, i32 0, i32 10, i32 10, i32 5, i32 1], [6 x i32] [i32 2, i32 10, i32 5, i32 0, i32 10, i32 3], [6 x i32] [i32 10, i32 3, i32 1, i32 4, i32 2, i32 10]], align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%pips = alloca [6 x i32], align 16
%pips2 = alloca [6 x i32], align 16
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %pips) #4
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %pips2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %pips)
%arrayidx.1 = getelementptr inbounds [6 x i32], ptr %pips, 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 %pips, 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 %pips, 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 %pips, 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 %pips, i64 0, i64 5
%call.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.5)
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %pips2)
%arrayidx5.1 = getelementptr inbounds [6 x i32], ptr %pips2, i64 0, i64 1
%call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1)
%arrayidx5.2 = getelementptr inbounds [6 x i32], ptr %pips2, i64 0, i64 2
%call6.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2)
%arrayidx5.3 = getelementptr inbounds [6 x i32], ptr %pips2, i64 0, i64 3
%call6.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3)
%arrayidx5.4 = getelementptr inbounds [6 x i32], ptr %pips2, i64 0, i64 4
%call6.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.4)
%arrayidx5.5 = getelementptr inbounds [6 x i32], ptr %pips2, i64 0, i64 5
%call6.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.5)
%0 = load i32, ptr %pips2, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%2 = load i32, ptr %arrayidx5.5, align 4
%3 = load i32, ptr %arrayidx5.4, align 16
%4 = load i32, ptr %pips, align 16, !tbaa !5
%5 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp16.1 = icmp eq i32 %5, %0
%6 = load i32, ptr %arrayidx.4, align 16
%cmp20.1 = icmp eq i32 %6, %2
%narrow = select i1 %cmp16.1, i1 %cmp20.1, i1 false
%top.1.1 = zext i1 %narrow to i32
%cmp24.1 = icmp eq i32 %5, %1
%cmp30.1 = icmp eq i32 %6, %3
%narrow115 = select i1 %cmp24.1, i1 %cmp30.1, i1 false
%front.1.1 = zext i1 %narrow115 to i32
%7 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%cmp16.2 = icmp eq i32 %7, %0
%.pre.pre = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp20.2 = icmp eq i32 %.pre.pre, %2
%8 = select i1 %cmp16.2, i1 %cmp20.2, i1 false
%top.1.2 = select i1 %8, i32 2, i32 %top.1.1
%cmp24.2 = icmp eq i32 %7, %1
%cmp30.2 = icmp eq i32 %.pre.pre, %3
%9 = select i1 %cmp24.2, i1 %cmp30.2, i1 false
%front.1.2 = select i1 %9, i32 2, i32 %front.1.1
%cmp16.3 = icmp eq i32 %.pre.pre, %0
%cmp20.3 = icmp eq i32 %7, %2
%10 = select i1 %cmp16.3, i1 %cmp20.3, i1 false
%top.1.3 = select i1 %10, i32 3, i32 %top.1.2
%cmp24.3 = icmp eq i32 %.pre.pre, %1
%cmp30.3 = icmp eq i32 %7, %3
%11 = select i1 %cmp24.3, i1 %cmp30.3, i1 false
%front.1.3 = select i1 %11, i32 3, i32 %front.1.2
%12 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp16.4 = icmp eq i32 %12, %0
%cmp20.4 = icmp eq i32 %5, %2
%13 = select i1 %cmp16.4, i1 %cmp20.4, i1 false
%top.1.4 = select i1 %13, i32 4, i32 %top.1.3
%cmp24.4 = icmp eq i32 %12, %1
%cmp30.4 = icmp eq i32 %5, %3
%14 = select i1 %cmp24.4, i1 %cmp30.4, i1 false
%front.1.4 = select i1 %14, i32 4, i32 %front.1.3
%15 = load i32, ptr %arrayidx.5, align 4, !tbaa !5
%cmp16.5 = icmp eq i32 %15, %0
%cmp20.5 = icmp eq i32 %4, %2
%16 = select i1 %cmp16.5, i1 %cmp20.5, i1 false
%top.1.5 = select i1 %16, i32 5, i32 %top.1.4
%cmp24.5 = icmp eq i32 %15, %1
%cmp30.5 = icmp eq i32 %4, %3
%17 = select i1 %cmp24.5, i1 %cmp30.5, i1 false
%front.1.5 = select i1 %17, i32 5, i32 %front.1.4
%idxprom36 = zext i32 %top.1.5 to i64
%idxprom38 = zext i32 %front.1.5 to i64
%arrayidx39 = getelementptr inbounds [6 x [6 x i32]], ptr @__const.main.dice, i64 0, i64 %idxprom36, i64 %idxprom38
%18 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%cmp40.not = icmp ne i32 %18, 10
%spec.select104 = zext i1 %cmp40.not to i32
%idxprom44 = sext i32 %18 to i64
%arrayidx45 = getelementptr inbounds [6 x i32], ptr %pips, i64 0, i64 %idxprom44
%19 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%20 = load i32, ptr %arrayidx5.2, align 8, !tbaa !5
%cmp47 = icmp eq i32 %19, %20
%inc49 = select i1 %cmp40.not, i32 2, i32 1
%j.1 = select i1 %cmp47, i32 %inc49, i32 %spec.select104
%sub51 = sub nsw i32 5, %18
%idxprom52 = sext i32 %sub51 to i64
%arrayidx53 = getelementptr inbounds [6 x i32], ptr %pips, i64 0, i64 %idxprom52
%21 = load i32, ptr %arrayidx53, align 4, !tbaa !5
%22 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5
%cmp55 = icmp eq i32 %21, %22
%inc57 = zext i1 %cmp55 to i32
%j.2 = add nuw nsw i32 %j.1, %inc57
%sub59 = sub nuw nsw i32 5, %front.1.5
%idxprom60 = zext i32 %sub59 to i64
%arrayidx61 = getelementptr inbounds [6 x i32], ptr %pips, i64 0, i64 %idxprom60
%23 = load i32, ptr %arrayidx61, align 4, !tbaa !5
%cmp63 = icmp eq i32 %23, %3
%inc65 = zext i1 %cmp63 to i32
%j.3 = add nuw nsw i32 %j.2, %inc65
%sub67 = sub nuw nsw i32 5, %top.1.5
%idxprom68 = zext i32 %sub67 to i64
%arrayidx69 = getelementptr inbounds [6 x i32], ptr %pips, i64 0, i64 %idxprom68
%24 = load i32, ptr %arrayidx69, align 4, !tbaa !5
%cmp71 = icmp eq i32 %24, %2
%inc73 = zext i1 %cmp71 to i32
%j.4 = add nuw nsw i32 %j.3, %inc73
%cmp75 = icmp eq i32 %j.4, 5
%str.sink = select i1 %cmp75, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %pips2) #4
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %pips) #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>
//#define DEBUG
#define YES 1
#define NO 0
typedef struct dice{
int TOP ;
int FRONT ;
int RIGHT ;
int LEFT ;
int BACK ;
int BOTTOM ;
}DICE;
#ifdef DEBUG
void showdice(DICE *); //???????¢??????¨
#endif
void dicescan(DICE *); //?????????????????????????????????
void rotateN(DICE *); //N?????¢
void rotateS(DICE *); //S?????¢
void rotateE(DICE *); //E?????¢
void rotateW(DICE *); //W?????¢
void rotateCW(DICE *); //TOP-BOTTOM????????¨??????????¨???????????????¢
int judge (int); //????????¨?????¨????????????????????°????????¨?????¢??°
int main(void){
DICE DICE1 = {1,2,3,4,5,6};
DICE DICE2 = {1,2,3,4,5,6};
int flag = 1 ; //??????????¢??????§?????????judge??¢??°???flag???0??????????????????
int i = 0 ; //???????????°
dicescan(&DICE1);
dicescan(&DICE2);
/*DICE1????????¬??¨???????????¢?????????*/
/*??????DICE1.TOP???DICE2????????¢???????????¢?????\??????????????????????????¢??????*/
if(DICE1.TOP == DICE2.TOP){
/*******??????????????????????????? ??????????????????????????£??????**********************************************************/
flag = judge(YES);
/*nop*/
}
else if(DICE1.TOP == DICE2.FRONT){
rotateN(&DICE2); //?????¢??????N?????¢
}
else if(DICE1.TOP == DICE2.RIGHT){
rotateW(&DICE2); //?????¢??????W?????¢
}
else if(DICE1.TOP == DICE2.LEFT){
rotateE(&DICE2); //?????¢??????E?????¢
}
else if(DICE1.TOP == DICE2.BACK){
rotateS(&DICE2); //?????¢??????S?????¢
}
else if(DICE1.TOP == DICE2.BOTTOM ){
rotateN(&DICE2);
rotateN(&DICE2); //?????¢??????N?????¢2???
}
else{
flag = judge(NO); //???????????????????????°?????´????????????????????¨????????????
}
/*????????????????????????flag???1(??????????¢???????????????????)?????´??????????????????*/
/*?????¨?????¶??????TOP????????´*/
/*?????¢????????????*/
if(flag && ( DICE1.BOTTOM != DICE2.BOTTOM) ){
flag = judge(NO); //?????¢????????´??????????????°?????????????????¨?¢????
}
/*?????¨?????¶??????TOP??¨BOTTOM????????´*/
while(flag){
if( DICE1.FRONT == DICE2.FRONT){ //FRONT????????´??????????¬???????????????????
break;
}
else{
rotateCW(&DICE2); //?????´??????????????°CW?????¢????????£????????????
i++;
}
if( i > 3){ //4????????????????????´??????????????°
flag = judge(NO); //DICE1.FRONT??????????????????????????§?????????????????¨?¢????
}
}
/*?????¨?????¶??????TOP???FRONT???BOTTOM????????´*/
/*??????????????????????????? Dice I ??¨????????¨?¨????????????????????????¨????????¢?????°????????°??????????????¨????????????*/
/*????????\????????????????????¢?????????????????????????????§??????????????¢?????°??????????????????*/
if(flag){
if( (DICE1.RIGHT == DICE2.RIGHT) && (DICE1.LEFT == DICE2.LEFT) && (DICE1.BACK == DICE2.BACK) ){
flag = judge(YES);
}
else{
flag = judge(NO);
}
}
/*??????????????§flag???1??????????????£?????????????????¨??????*/
if(flag){
printf("error\n");
}
return 0;
}
void rotateN(DICE *rotate){
int tmp = 0;
tmp = rotate -> BACK ;
rotate -> BACK = rotate -> TOP ;
rotate -> TOP = rotate -> FRONT ;
rotate -> FRONT = rotate -> BOTTOM ;
rotate -> BOTTOM = tmp ;
}
void rotateS(DICE *rotate){
/*N?????¢???3???*/
rotateN(rotate);
rotateN(rotate);
rotateN(rotate);
}
void rotateE(DICE *rotate){
int tmp = 0;
tmp = rotate -> TOP ;
rotate -> TOP = rotate -> LEFT ;
rotate -> LEFT = rotate -> BOTTOM ;
rotate -> BOTTOM = rotate -> RIGHT ;
rotate -> RIGHT = tmp ;
}
void rotateW(DICE *rotate){
/*E?????¢???3???*/
rotateE(rotate);
rotateE(rotate);
rotateE(rotate);
}
void rotateCW(DICE *rotate){
int tmp = 0;
tmp = rotate -> BACK ;
rotate -> BACK = rotate -> LEFT;
rotate -> LEFT = rotate -> FRONT ;
rotate -> FRONT = rotate -> RIGHT;
rotate -> RIGHT = tmp ;
}
void dicescan(DICE *scan){
scanf("%d",&scan -> TOP);
scanf("%d",&scan -> FRONT);
scanf("%d",&scan -> RIGHT);
scanf("%d",&scan -> LEFT);
scanf("%d",&scan -> BACK);
scanf("%d",&scan -> BOTTOM);
}
int judge (int i){
if(i){ //?????°???YES?????´???
printf("Yes\n");
return 0;
}
else{ //?????°???NO?????´???
printf("No\n");
return 0;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117082/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117082/source.c"
target datalayout = "e-m:e-p270: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.dice = type { i32, i32, i32, i32, i32, i32 }
@__const.main.DICE2 = private unnamed_addr constant %struct.dice { i32 1, i32 2, i32 3, i32 4, i32 5, i32 6 }, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%DICE1 = alloca %struct.dice, align 4
%DICE2 = alloca %struct.dice, align 4
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %DICE1) #6
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) %DICE1, ptr noundef nonnull align 4 dereferenceable(24) @__const.main.DICE2, i64 24, i1 false)
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %DICE2) #6
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) %DICE2, ptr noundef nonnull align 4 dereferenceable(24) @__const.main.DICE2, i64 24, i1 false)
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %DICE1)
%FRONT.i = getelementptr inbounds %struct.dice, ptr %DICE1, i64 0, i32 1
%call1.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %FRONT.i)
%RIGHT.i = getelementptr inbounds %struct.dice, ptr %DICE1, i64 0, i32 2
%call2.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %RIGHT.i)
%LEFT.i = getelementptr inbounds %struct.dice, ptr %DICE1, i64 0, i32 3
%call3.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %LEFT.i)
%BACK.i = getelementptr inbounds %struct.dice, ptr %DICE1, i64 0, i32 4
%call4.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %BACK.i)
%BOTTOM.i = getelementptr inbounds %struct.dice, ptr %DICE1, i64 0, i32 5
%call5.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %BOTTOM.i)
%call.i72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %DICE2)
%FRONT.i73 = getelementptr inbounds %struct.dice, ptr %DICE2, i64 0, i32 1
%call1.i74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %FRONT.i73)
%RIGHT.i75 = getelementptr inbounds %struct.dice, ptr %DICE2, i64 0, i32 2
%call2.i76 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %RIGHT.i75)
%LEFT.i77 = getelementptr inbounds %struct.dice, ptr %DICE2, i64 0, i32 3
%call3.i78 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %LEFT.i77)
%BACK.i79 = getelementptr inbounds %struct.dice, ptr %DICE2, i64 0, i32 4
%call4.i80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %BACK.i79)
%BOTTOM.i81 = getelementptr inbounds %struct.dice, ptr %DICE2, i64 0, i32 5
%call5.i82 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %BOTTOM.i81)
%0 = load i32, ptr %DICE1, align 4, !tbaa !5
%1 = load i32, ptr %DICE2, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
br i1 %cmp, label %if.end67, label %if.else
if.else: ; preds = %entry
%2 = load i32, ptr %FRONT.i73, align 4, !tbaa !10
%cmp3 = icmp eq i32 %0, %2
br i1 %cmp3, label %if.then4, label %if.else5
if.then4: ; preds = %if.else
%3 = load i32, ptr %BACK.i79, align 4, !tbaa !11
store i32 %1, ptr %BACK.i79, align 4, !tbaa !11
store i32 %0, ptr %DICE2, align 4, !tbaa !5
%4 = load i32, ptr %BOTTOM.i81, align 4, !tbaa !12
store i32 %4, ptr %FRONT.i73, align 4, !tbaa !10
store i32 %3, ptr %BOTTOM.i81, align 4, !tbaa !12
br label %land.lhs.true
if.else5: ; preds = %if.else
%5 = load i32, ptr %RIGHT.i75, align 4, !tbaa !13
%cmp7 = icmp eq i32 %0, %5
%6 = load i32, ptr %LEFT.i77, align 4, !tbaa !14
br i1 %cmp7, label %if.then8, label %if.else9
if.then8: ; preds = %if.else5
%7 = load i32, ptr %BOTTOM.i81, align 4, !tbaa !12
store i32 %0, ptr %DICE2, align 4, !tbaa !5
store i32 %1, ptr %LEFT.i77, align 4, !tbaa !14
store i32 %6, ptr %BOTTOM.i81, align 4, !tbaa !12
store i32 %7, ptr %RIGHT.i75, align 4, !tbaa !13
br label %land.lhs.true
if.else9: ; preds = %if.else5
%cmp11 = icmp eq i32 %0, %6
br i1 %cmp11, label %if.then12, label %if.else13
if.then12: ; preds = %if.else9
store i32 %0, ptr %DICE2, align 4, !tbaa !5
%8 = load i32, ptr %BOTTOM.i81, align 4, !tbaa !12
store i32 %8, ptr %LEFT.i77, align 4, !tbaa !14
store i32 %5, ptr %BOTTOM.i81, align 4, !tbaa !12
store i32 %1, ptr %RIGHT.i75, align 4, !tbaa !13
br label %land.lhs.true
if.else13: ; preds = %if.else9
%9 = load i32, ptr %BACK.i79, align 4, !tbaa !11
%cmp15 = icmp eq i32 %0, %9
%10 = load i32, ptr %BOTTOM.i81, align 4, !tbaa !12
br i1 %cmp15, label %if.then16, label %if.else17
if.then16: ; preds = %if.else13
store i32 %10, ptr %BACK.i79, align 4, !tbaa !11
store i32 %0, ptr %DICE2, align 4, !tbaa !5
store i32 %1, ptr %FRONT.i73, align 4, !tbaa !10
store i32 %2, ptr %BOTTOM.i81, align 4, !tbaa !12
br label %land.lhs.true
if.else17: ; preds = %if.else13
%cmp19 = icmp eq i32 %0, %10
br i1 %cmp19, label %if.then20, label %if.end67
if.then20: ; preds = %if.else17
store i32 %2, ptr %BACK.i79, align 4, !tbaa !11
store i32 %0, ptr %DICE2, align 4, !tbaa !5
store i32 %9, ptr %FRONT.i73, align 4, !tbaa !10
store i32 %1, ptr %BOTTOM.i81, align 4, !tbaa !12
br label %land.lhs.true
land.lhs.true: ; preds = %if.then8, %if.then16, %if.then20, %if.then12, %if.then4
%11 = phi i32 [ %6, %if.then8 ], [ %2, %if.then16 ], [ %1, %if.then20 ], [ %5, %if.then12 ], [ %3, %if.then4 ]
%12 = load i32, ptr %BOTTOM.i, align 4, !tbaa !12
%cmp30.not = icmp eq i32 %12, %11
br i1 %cmp30.not, label %while.body.preheader, label %if.end67
while.body.preheader: ; preds = %land.lhs.true
%13 = load i32, ptr %FRONT.i, align 4, !tbaa !10
%14 = load <2 x i32>, ptr %FRONT.i73, align 4, !tbaa !15
%15 = extractelement <2 x i32> %14, i64 0
%cmp37 = icmp eq i32 %13, %15
%16 = extractelement <2 x i32> %14, i64 1
br i1 %cmp37, label %if.then46, label %if.end44
if.end44: ; preds = %while.body.preheader
%17 = load <2 x i32>, ptr %LEFT.i77, align 4, !tbaa !15
%18 = extractelement <2 x i32> %17, i64 1
%19 = shufflevector <2 x i32> %14, <2 x i32> %17, <4 x i32> <i32 1, i32 3, i32 0, i32 2>
store <4 x i32> %19, ptr %FRONT.i73, align 4, !tbaa !15
%cmp37.1 = icmp eq i32 %13, %16
br i1 %cmp37.1, label %if.then46, label %if.end44.1
if.end44.1: ; preds = %if.end44
%20 = extractelement <2 x i32> %17, i64 0
%21 = shufflevector <2 x i32> %17, <2 x i32> %14, <4 x i32> <i32 1, i32 0, i32 3, i32 2>
store <4 x i32> %21, ptr %FRONT.i73, align 4, !tbaa !15
%cmp37.2 = icmp eq i32 %13, %18
br i1 %cmp37.2, label %if.then46, label %if.end44.2
if.end44.2: ; preds = %if.end44.1
%22 = shufflevector <2 x i32> %17, <2 x i32> %14, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %22, ptr %FRONT.i73, align 4, !tbaa !15
%cmp37.3 = icmp eq i32 %13, %20
br i1 %cmp37.3, label %if.then46, label %if.end44.3
if.end44.3: ; preds = %if.end44.2
%23 = shufflevector <2 x i32> %14, <2 x i32> %17, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
store <4 x i32> %23, ptr %FRONT.i73, align 4, !tbaa !15
br label %if.end67
if.then46: ; preds = %if.end44.2, %if.end44.1, %if.end44, %while.body.preheader
%24 = phi i32 [ %15, %if.end44.2 ], [ %20, %if.end44.1 ], [ %18, %if.end44 ], [ %16, %while.body.preheader ]
%25 = load i32, ptr %RIGHT.i, align 4, !tbaa !13
%cmp49 = icmp eq i32 %25, %24
br i1 %cmp49, label %land.lhs.true50, label %if.else60
land.lhs.true50: ; preds = %if.then46
%26 = load i32, ptr %LEFT.i, align 4, !tbaa !14
%27 = load i32, ptr %LEFT.i77, align 4, !tbaa !14
%cmp53 = icmp eq i32 %26, %27
br i1 %cmp53, label %land.lhs.true54, label %if.else60
land.lhs.true54: ; preds = %land.lhs.true50
%28 = load i32, ptr %BACK.i, align 4, !tbaa !11
%29 = load i32, ptr %BACK.i79, align 4, !tbaa !11
%cmp57 = icmp eq i32 %28, %29
br i1 %cmp57, label %if.end67, label %if.else60
if.else60: ; preds = %land.lhs.true54, %land.lhs.true50, %if.then46
br label %if.end67
if.end67: ; preds = %land.lhs.true54, %land.lhs.true, %if.else17, %entry, %if.end44.3, %if.else60
%str.4.sink = phi ptr [ @str, %if.end44.3 ], [ @str, %if.else60 ], [ @str.4, %entry ], [ @str, %if.else17 ], [ @str, %land.lhs.true ], [ @str.4, %land.lhs.true54 ]
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %DICE2) #6
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %DICE1) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @dicescan(ptr noundef %scan) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %scan)
%FRONT = getelementptr inbounds %struct.dice, ptr %scan, i64 0, i32 1
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %FRONT)
%RIGHT = getelementptr inbounds %struct.dice, ptr %scan, i64 0, i32 2
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %RIGHT)
%LEFT = getelementptr inbounds %struct.dice, ptr %scan, i64 0, i32 3
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %LEFT)
%BACK = getelementptr inbounds %struct.dice, ptr %scan, i64 0, i32 4
%call4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %BACK)
%BOTTOM = getelementptr inbounds %struct.dice, ptr %scan, i64 0, i32 5
%call5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %BOTTOM)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @judge(i32 noundef %i) local_unnamed_addr #0 {
entry:
%tobool.not = icmp eq i32 %i, 0
%str.str.4 = select i1 %tobool.not, ptr @str, ptr @str.4
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.str.4)
ret i32 0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @rotateN(ptr nocapture noundef %rotate) local_unnamed_addr #3 {
entry:
%BACK = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 4
%0 = load i32, ptr %BACK, align 4, !tbaa !11
%1 = load i32, ptr %rotate, align 4, !tbaa !5
store i32 %1, ptr %BACK, align 4, !tbaa !11
%FRONT = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 1
%2 = load i32, ptr %FRONT, align 4, !tbaa !10
store i32 %2, ptr %rotate, align 4, !tbaa !5
%BOTTOM = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 5
%3 = load i32, ptr %BOTTOM, align 4, !tbaa !12
store i32 %3, ptr %FRONT, align 4, !tbaa !10
store i32 %0, ptr %BOTTOM, align 4, !tbaa !12
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @rotateW(ptr nocapture noundef %rotate) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %rotate, align 4, !tbaa !5
%LEFT.i = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 3
%1 = load i32, ptr %LEFT.i, align 4, !tbaa !14
%BOTTOM.i = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 5
%2 = load i32, ptr %BOTTOM.i, align 4, !tbaa !12
%RIGHT.i = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 2
%3 = load i32, ptr %RIGHT.i, align 4, !tbaa !13
store i32 %3, ptr %rotate, align 4, !tbaa !5
store i32 %0, ptr %LEFT.i, align 4, !tbaa !14
store i32 %1, ptr %BOTTOM.i, align 4, !tbaa !12
store i32 %2, ptr %RIGHT.i, align 4, !tbaa !13
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @rotateE(ptr nocapture noundef %rotate) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %rotate, align 4, !tbaa !5
%LEFT = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 3
%1 = load i32, ptr %LEFT, align 4, !tbaa !14
store i32 %1, ptr %rotate, align 4, !tbaa !5
%BOTTOM = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 5
%2 = load i32, ptr %BOTTOM, align 4, !tbaa !12
store i32 %2, ptr %LEFT, align 4, !tbaa !14
%RIGHT = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 2
%3 = load i32, ptr %RIGHT, align 4, !tbaa !13
store i32 %3, ptr %BOTTOM, align 4, !tbaa !12
store i32 %0, ptr %RIGHT, align 4, !tbaa !13
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @rotateS(ptr nocapture noundef %rotate) local_unnamed_addr #3 {
entry:
%BACK.i = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 4
%0 = load i32, ptr %BACK.i, align 4, !tbaa !11
%1 = load i32, ptr %rotate, align 4, !tbaa !5
%FRONT.i = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 1
%2 = load i32, ptr %FRONT.i, align 4, !tbaa !10
%BOTTOM.i = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 5
%3 = load i32, ptr %BOTTOM.i, align 4, !tbaa !12
store i32 %3, ptr %BACK.i, align 4, !tbaa !11
store i32 %0, ptr %rotate, align 4, !tbaa !5
store i32 %1, ptr %FRONT.i, align 4, !tbaa !10
store i32 %2, ptr %BOTTOM.i, align 4, !tbaa !12
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @rotateCW(ptr nocapture noundef %rotate) local_unnamed_addr #3 {
entry:
%FRONT = getelementptr inbounds %struct.dice, ptr %rotate, i64 0, i32 1
%0 = load <4 x i32>, ptr %FRONT, align 4, !tbaa !15
%1 = shufflevector <4 x i32> %0, <4 x i32> poison, <4 x i32> <i32 1, i32 3, i32 0, i32 2>
store <4 x i32> %1, ptr %FRONT, align 4, !tbaa !15
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 @__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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"dice", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 20}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 12}
!15 = !{!7, !7, i64 0}
|
#include <stdio.h>
#include <string.h>
char str[110];
int i,j,k,l,m,n;
int n,e,s,w,un,up;
int a[7],b[7], qu[25],qf[25],ufl[25];
int a2[7],b2[7];
int t;
void input() {
for(i=0;i<6;i++){
scanf("%d",&a[i+1]);
b[i+1] = a[i+1];
}
for(i=0;i<6;i++){
scanf("%d",&a2[i+1]);
b2[i+1] = a2[i+1];
}
}
void N() {
t = a[1];
a[1] = a[2];
a[2] = a[6];
a[6] = a[5];
a[5] = t;
}
void S() {
t = a[1];
a[1] = a[5];
a[5] = a[6];
a[6] = a[2];
a[2] = t;
}
void E() {
t = a[1];
a[1] = a[4];
a[4] = a[6];
a[6] = a[3];
a[3] = t;
}
void W() {
t = a[1];
a[1] = a[3];
a[3] = a[6];
a[6] = a[4];
a[4] = t;
}
void UF() {
if(a2[1] == a[1]) {
if(a2[2] == a[3]) strcpy( str, "NWS");
else if(a2[2] == a[5]) strcpy(str ,"NEES");
else if(a2[2] == a[4]) strcpy(str,"NES");
else if(a2[2] == a[6]) strcpy(str, "N");
}
else if(a2[1] == a[2]) {
if(a2[2] == a[3]) strcpy( str, "NWS");
else if(a2[2] == a[1] ) strcpy(str ,"NEES");
else if(a2[2] == a[4]) strcpy(str,"NES");
else if(a2[2] == a[5]) strcpy(str, "N");
N();
}
else if(a2[1] == a[3]){
if(a2[2] == a[6]) strcpy( str, "NWS");
else if(a2[2] == a[5]) strcpy(str ,"NEES");
else if(a2[2] == a[1]) strcpy(str,"NES");
else if(a2[2] == a[4]) strcpy(str, "N");
W();
}
else if(a2[1] == a[4]) {
if(a2[2] == a[1]) strcpy( str, "NWS");
if(a2[2] == a[5]) strcpy(str ,"NEES");
if(a2[2] == a[6]) strcpy(str,"NES");
else if(a2[2] == a[3]) strcpy(str, "N");
E();
}
else if(a2[1] == a[5]) {
if(a2[2] == a[3]) strcpy( str, "NWS");
else if(a2[2] == a[6]) strcpy(str ,"NEES");
else if(a2[2] == a[4]) strcpy(str,"NES");
else if(a2[2] == a[2]) strcpy(str, "N");
S();
}
else if(a2[1] == a[6]) {
if(a2[2] == a[3]) strcpy( str, "NWS");
else if(a2[2] == a[2]) strcpy(str ,"NEES");
else if(a2[2] == a[4]) strcpy(str,"NES");
else if(a2[2] == a[1]) strcpy(str, "N");
N();
N();
}
}
void reset() {
strcpy(str , "");
for(i=1;i<=6;i++){
a[i] = b[i];
}
}
void output() {
k = 0;
for(i=1;i<=6;i++) {
if(a[i] == a2[i]) k++;
}
if(k == 6) printf("Yes\n");
else printf("No\n");
}
void IF() {
for(i=0;i<strlen(str);i++) {
if(str[i] == 'N') N();
else if(str[i] == 'S') S();
else if(str[i] == 'W') W();
else if(str[i] == 'E') E();
}
}
int main(void) {
input();
UF();
IF();
output();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117211/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117211/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@i = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@a = dso_local global [7 x i32] zeroinitializer, align 16
@b = dso_local local_unnamed_addr global [7 x i32] zeroinitializer, align 16
@a2 = dso_local global [7 x i32] zeroinitializer, align 16
@b2 = dso_local local_unnamed_addr global [7 x i32] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global i32 0, align 4
@str = dso_local global [110 x i8] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [5 x i8] c"NEES\00", align 1
@k = dso_local local_unnamed_addr global i32 0, align 4
@j = dso_local local_unnamed_addr global i32 0, align 4
@l = dso_local local_unnamed_addr global i32 0, align 4
@m = dso_local local_unnamed_addr global i32 0, align 4
@n = dso_local local_unnamed_addr global i32 0, align 4
@e = dso_local local_unnamed_addr global i32 0, align 4
@s = dso_local local_unnamed_addr global i32 0, align 4
@w = dso_local local_unnamed_addr global i32 0, align 4
@un = dso_local local_unnamed_addr global i32 0, align 4
@up = dso_local local_unnamed_addr global i32 0, align 4
@qu = dso_local local_unnamed_addr global [25 x i32] zeroinitializer, align 16
@qf = dso_local local_unnamed_addr global [25 x i32] zeroinitializer, align 16
@ufl = dso_local local_unnamed_addr global [25 x i32] zeroinitializer, align 16
@str.8 = 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 nounwind uwtable
define dso_local void @input() local_unnamed_addr #0 {
entry:
store i32 0, ptr @i, align 4, !tbaa !5
br label %for.body
for.cond7.preheader: ; preds = %for.body
store i32 0, ptr @i, align 4, !tbaa !5
br label %for.body9
for.body: ; preds = %entry, %for.body
%storemerge25 = phi i32 [ 0, %entry ], [ %add1, %for.body ]
%add = add nsw i32 %storemerge25, 1
%idxprom = sext i32 %add to i64
%arrayidx = getelementptr inbounds [7 x i32], ptr @a, i64 0, i64 %idxprom
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%0 = load i32, ptr @i, align 4, !tbaa !5
%add1 = add nsw i32 %0, 1
%idxprom2 = sext i32 %add1 to i64
%arrayidx3 = getelementptr inbounds [7 x i32], ptr @a, i64 0, i64 %idxprom2
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%arrayidx6 = getelementptr inbounds [7 x i32], ptr @b, i64 0, i64 %idxprom2
store i32 %1, ptr %arrayidx6, align 4, !tbaa !5
store i32 %add1, ptr @i, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 5
br i1 %cmp, label %for.body, label %for.cond7.preheader, !llvm.loop !9
for.body9: ; preds = %for.cond7.preheader, %for.body9
%storemerge2426 = phi i32 [ 0, %for.cond7.preheader ], [ %add14, %for.body9 ]
%add10 = add nsw i32 %storemerge2426, 1
%idxprom11 = sext i32 %add10 to i64
%arrayidx12 = getelementptr inbounds [7 x i32], ptr @a2, i64 0, i64 %idxprom11
%call13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx12)
%2 = load i32, ptr @i, align 4, !tbaa !5
%add14 = add nsw i32 %2, 1
%idxprom15 = sext i32 %add14 to i64
%arrayidx16 = getelementptr inbounds [7 x i32], ptr @a2, i64 0, i64 %idxprom15
%3 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%arrayidx19 = getelementptr inbounds [7 x i32], ptr @b2, i64 0, i64 %idxprom15
store i32 %3, ptr %arrayidx19, align 4, !tbaa !5
store i32 %add14, ptr @i, align 4, !tbaa !5
%cmp8 = icmp slt i32 %2, 5
br i1 %cmp8, label %for.body9, label %for.end22, !llvm.loop !11
for.end22: ; preds = %for.body9
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @N() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 %0, ptr @t, align 4, !tbaa !5
%1 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
store i32 %1, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
%2 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %2, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
%3 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
store i32 %3, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @S() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 %0, ptr @t, align 4, !tbaa !5
%1 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
store i32 %1, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
%2 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %2, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
%3 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
store i32 %3, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @E() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 %0, ptr @t, align 4, !tbaa !5
%1 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
store i32 %1, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
%2 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %2, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
%3 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
store i32 %3, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @W() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 %0, ptr @t, align 4, !tbaa !5
%1 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
store i32 %1, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
%2 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %2, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
%3 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
store i32 %3, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @UF() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 1), align 4, !tbaa !5
%1 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
br i1 %cmp, label %if.then, label %if.else17
if.then: ; preds = %entry
%2 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 2), align 8, !tbaa !5
%3 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
%cmp1 = icmp eq i32 %2, %3
br i1 %cmp1, label %if.then2, label %if.else
if.then2: ; preds = %if.then
store i32 5461838, ptr @str, align 16
br label %if.end130
if.else: ; preds = %if.then
%4 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
%cmp3 = icmp eq i32 %2, %4
br i1 %cmp3, label %if.then4, label %if.else6
if.then4: ; preds = %if.else
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(5) @str, ptr noundef nonnull align 1 dereferenceable(5) @.str.2, i64 5, i1 false) #8
br label %if.end130
if.else6: ; preds = %if.else
%5 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
%cmp7 = icmp eq i32 %2, %5
br i1 %cmp7, label %if.then8, label %if.else10
if.then8: ; preds = %if.else6
store i32 5457230, ptr @str, align 16
br label %if.end130
if.else10: ; preds = %if.else6
%6 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
%cmp11 = icmp eq i32 %2, %6
br i1 %cmp11, label %if.then12, label %if.end130
if.then12: ; preds = %if.else10
store i16 78, ptr @str, align 16
br label %if.end130
if.else17: ; preds = %entry
%7 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
%cmp18 = icmp eq i32 %0, %7
br i1 %cmp18, label %if.then19, label %if.else39
if.then19: ; preds = %if.else17
%8 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 2), align 8, !tbaa !5
%9 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
%cmp20 = icmp eq i32 %8, %9
br i1 %cmp20, label %if.then21, label %if.else23
if.then21: ; preds = %if.then19
store i32 5461838, ptr @str, align 16
br label %if.end38
if.else23: ; preds = %if.then19
%cmp24 = icmp eq i32 %8, %1
br i1 %cmp24, label %if.then25, label %if.else27
if.then25: ; preds = %if.else23
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(5) @str, ptr noundef nonnull align 1 dereferenceable(5) @.str.2, i64 5, i1 false) #8
br label %if.end38
if.else27: ; preds = %if.else23
%10 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
%cmp28 = icmp eq i32 %8, %10
br i1 %cmp28, label %if.then29, label %if.else31
if.then29: ; preds = %if.else27
store i32 5457230, ptr @str, align 16
br label %if.end38
if.else31: ; preds = %if.else27
%11 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
%cmp32 = icmp eq i32 %8, %11
br i1 %cmp32, label %if.then33, label %if.end38
if.then33: ; preds = %if.else31
store i16 78, ptr @str, align 16
br label %if.end38
if.end38: ; preds = %if.then25, %if.else31, %if.then33, %if.then29, %if.then21
store i32 %1, ptr @t, align 4, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
%12 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %12, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
%13 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
store i32 %13, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %1, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
br label %if.end130
if.else39: ; preds = %if.else17
%14 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
%cmp40 = icmp eq i32 %0, %14
br i1 %cmp40, label %if.then41, label %if.else61
if.then41: ; preds = %if.else39
%15 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 2), align 8, !tbaa !5
%16 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
%cmp42 = icmp eq i32 %15, %16
br i1 %cmp42, label %if.then43, label %if.else45
if.then43: ; preds = %if.then41
store i32 5461838, ptr @str, align 16
br label %if.end60
if.else45: ; preds = %if.then41
%17 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
%cmp46 = icmp eq i32 %15, %17
br i1 %cmp46, label %if.then47, label %if.else49
if.then47: ; preds = %if.else45
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(5) @str, ptr noundef nonnull align 1 dereferenceable(5) @.str.2, i64 5, i1 false) #8
br label %if.end60
if.else49: ; preds = %if.else45
%cmp50 = icmp eq i32 %15, %1
br i1 %cmp50, label %if.then51, label %if.else53
if.then51: ; preds = %if.else49
store i32 5457230, ptr @str, align 16
br label %if.end60
if.else53: ; preds = %if.else49
%18 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
%cmp54 = icmp eq i32 %15, %18
br i1 %cmp54, label %if.then55, label %if.end60
if.then55: ; preds = %if.else53
store i16 78, ptr @str, align 16
br label %if.end60
if.end60: ; preds = %if.then47, %if.else53, %if.then55, %if.then51, %if.then43
store i32 %1, ptr @t, align 4, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 %16, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
%19 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
store i32 %19, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %1, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
br label %if.end130
if.else61: ; preds = %if.else39
%20 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
%cmp62 = icmp eq i32 %0, %20
br i1 %cmp62, label %if.then63, label %if.else81
if.then63: ; preds = %if.else61
%21 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 2), align 8, !tbaa !5
%cmp64 = icmp eq i32 %21, %1
br i1 %cmp64, label %if.then65, label %if.end67
if.then65: ; preds = %if.then63
store i32 5461838, ptr @str, align 16
br label %if.end67
if.end67: ; preds = %if.then65, %if.then63
%22 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
%cmp68 = icmp eq i32 %21, %22
br i1 %cmp68, label %if.then69, label %if.end71
if.then69: ; preds = %if.end67
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(5) @str, ptr noundef nonnull align 1 dereferenceable(5) @.str.2, i64 5, i1 false) #8
br label %if.end71
if.end71: ; preds = %if.then69, %if.end67
%23 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
%cmp72 = icmp eq i32 %21, %23
br i1 %cmp72, label %if.then73, label %if.else75
if.then73: ; preds = %if.end71
store i32 5457230, ptr @str, align 16
br label %if.end80
if.else75: ; preds = %if.end71
%cmp76 = icmp eq i32 %21, %14
br i1 %cmp76, label %if.then77, label %if.end80
if.then77: ; preds = %if.else75
store i16 78, ptr @str, align 16
br label %if.end80
if.end80: ; preds = %if.else75, %if.then77, %if.then73
store i32 %1, ptr @t, align 4, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 %23, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
store i32 %14, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %1, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
br label %if.end130
if.else81: ; preds = %if.else61
%24 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
%cmp82 = icmp eq i32 %0, %24
br i1 %cmp82, label %if.then83, label %if.else103
if.then83: ; preds = %if.else81
%25 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 2), align 8, !tbaa !5
%cmp84 = icmp eq i32 %25, %14
br i1 %cmp84, label %if.then85, label %if.else87
if.then85: ; preds = %if.then83
store i32 5461838, ptr @str, align 16
%.pre = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
br label %if.end102
if.else87: ; preds = %if.then83
%26 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
%cmp88 = icmp eq i32 %25, %26
br i1 %cmp88, label %if.then89, label %if.else91
if.then89: ; preds = %if.else87
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(5) @str, ptr noundef nonnull align 1 dereferenceable(5) @.str.2, i64 5, i1 false) #8
br label %if.end102
if.else91: ; preds = %if.else87
%cmp92 = icmp eq i32 %25, %20
br i1 %cmp92, label %if.then93, label %if.else95
if.then93: ; preds = %if.else91
store i32 5457230, ptr @str, align 16
br label %if.end102
if.else95: ; preds = %if.else91
%cmp96 = icmp eq i32 %25, %7
br i1 %cmp96, label %if.then97, label %if.end102
if.then97: ; preds = %if.else95
store i16 78, ptr @str, align 16
br label %if.end102
if.end102: ; preds = %if.then89, %if.else95, %if.then97, %if.then93, %if.then85
%27 = phi i32 [ %25, %if.then89 ], [ %26, %if.else95 ], [ %26, %if.then97 ], [ %26, %if.then93 ], [ %.pre, %if.then85 ]
store i32 %1, ptr @t, align 4, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 %27, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
store i32 %7, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %1, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
br label %if.end130
if.else103: ; preds = %if.else81
%28 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
%cmp104 = icmp eq i32 %0, %28
br i1 %cmp104, label %if.then105, label %if.end130
if.then105: ; preds = %if.else103
%29 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 2), align 8, !tbaa !5
%cmp106 = icmp eq i32 %29, %14
br i1 %cmp106, label %if.then107, label %if.else109
if.then107: ; preds = %if.then105
store i32 5461838, ptr @str, align 16
br label %if.end124
if.else109: ; preds = %if.then105
%cmp110 = icmp eq i32 %29, %7
br i1 %cmp110, label %if.then111, label %if.else113
if.then111: ; preds = %if.else109
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(5) @str, ptr noundef nonnull align 1 dereferenceable(5) @.str.2, i64 5, i1 false) #8
br label %if.end124
if.else113: ; preds = %if.else109
%cmp114 = icmp eq i32 %29, %20
br i1 %cmp114, label %if.then115, label %if.else117
if.then115: ; preds = %if.else113
store i32 5457230, ptr @str, align 16
br label %if.end124
if.else117: ; preds = %if.else113
%cmp118 = icmp eq i32 %29, %1
br i1 %cmp118, label %if.then119, label %if.end124
if.then119: ; preds = %if.else117
store i16 78, ptr @str, align 16
br label %if.end124
if.end124: ; preds = %if.then111, %if.else117, %if.then119, %if.then115, %if.then107
store i32 %7, ptr @t, align 4, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 %24, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
store i32 %1, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %7, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
br label %if.end130
if.end130: ; preds = %if.end38, %if.end80, %if.else103, %if.end124, %if.end102, %if.end60, %if.then2, %if.then8, %if.then12, %if.else10, %if.then4
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @reset() local_unnamed_addr #3 {
entry:
store i8 0, ptr @str, align 16
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), ptr noundef nonnull align 4 dereferenceable(24) getelementptr inbounds ([7 x i32], ptr @b, i64 0, i64 1), i64 24, i1 false), !tbaa !5
store i32 7, ptr @i, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @output() local_unnamed_addr #0 {
entry:
store i32 0, ptr @k, align 4, !tbaa !5
%0 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
%1 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 1), align 4, !tbaa !5
%cmp3 = icmp eq i32 %0, %1
%spec.store.select = zext i1 %cmp3 to i32
store i32 %spec.store.select, ptr @k, align 4
%spec.select = zext i1 %cmp3 to i32
%2 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
%3 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 2), align 8, !tbaa !5
%cmp3.1 = icmp eq i32 %2, %3
br i1 %cmp3.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %entry
%inc.1 = select i1 %cmp3, i32 2, i32 1
store i32 %inc.1, ptr @k, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %entry
%inc10.1 = phi i32 [ %spec.select, %entry ], [ %inc.1, %if.then.1 ]
%4 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
%5 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 3), align 4, !tbaa !5
%cmp3.2 = icmp eq i32 %4, %5
br i1 %cmp3.2, label %if.then.2, label %for.inc.2
if.then.2: ; preds = %for.inc.1
%inc.2 = add nuw nsw i32 %inc10.1, 1
store i32 %inc.2, ptr @k, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %for.inc.1
%inc10.2 = phi i32 [ %inc10.1, %for.inc.1 ], [ %inc.2, %if.then.2 ]
%6 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
%7 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 4), align 16, !tbaa !5
%cmp3.3 = icmp eq i32 %6, %7
br i1 %cmp3.3, label %if.then.3, label %for.inc.3
if.then.3: ; preds = %for.inc.2
%inc.3 = add nuw nsw i32 %inc10.2, 1
store i32 %inc.3, ptr @k, align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %for.inc.2
%inc10.3 = phi i32 [ %inc10.2, %for.inc.2 ], [ %inc.3, %if.then.3 ]
%8 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
%9 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 5), align 4, !tbaa !5
%cmp3.4 = icmp eq i32 %8, %9
br i1 %cmp3.4, label %if.then.4, label %for.inc.4
if.then.4: ; preds = %for.inc.3
%inc.4 = add nuw nsw i32 %inc10.3, 1
store i32 %inc.4, ptr @k, align 4, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.then.4, %for.inc.3
%inc10.4 = phi i32 [ %inc10.3, %for.inc.3 ], [ %inc.4, %if.then.4 ]
%10 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
%11 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 6), align 8, !tbaa !5
%cmp3.5 = icmp eq i32 %10, %11
br i1 %cmp3.5, label %for.inc.5, label %for.inc.5.thread
for.inc.5.thread: ; preds = %for.inc.4
store i32 7, ptr @i, align 4, !tbaa !5
br label %if.else
for.inc.5: ; preds = %for.inc.4
%inc.5 = add nuw nsw i32 %inc10.4, 1
store i32 %inc.5, ptr @k, align 4, !tbaa !5
store i32 7, ptr @i, align 4, !tbaa !5
%cmp5 = icmp eq i32 %inc.5, 6
br i1 %cmp5, label %if.end8, label %if.else
if.else: ; preds = %for.inc.5.thread, %for.inc.5
br label %if.end8
if.end8: ; preds = %for.inc.5, %if.else
%str.8.sink = phi ptr [ @str.8, %if.else ], [ @str.9, %for.inc.5 ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.8.sink)
ret void
}
; Function Attrs: nofree nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @IF() local_unnamed_addr #4 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @str) #9
%cmp33.not = icmp eq i64 %call, 0
br i1 %cmp33.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%.promoted32 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
%.promoted31 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
%.promoted30 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
%.promoted29 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
%.promoted28 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
%.promoted = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%0 = phi i32 [ %.promoted, %for.body.preheader ], [ %12, %for.inc ]
%1 = phi i32 [ %.promoted28, %for.body.preheader ], [ %11, %for.inc ]
%2 = phi i32 [ %.promoted29, %for.body.preheader ], [ %10, %for.inc ]
%3 = phi i32 [ %.promoted30, %for.body.preheader ], [ %9, %for.inc ]
%4 = phi i32 [ %.promoted31, %for.body.preheader ], [ %8, %for.inc ]
%5 = phi i32 [ %.promoted32, %for.body.preheader ], [ %7, %for.inc ]
%arrayidx = getelementptr inbounds [110 x i8], ptr @str, i64 0, i64 %indvars.iv
%6 = load i8, ptr %arrayidx, align 1, !tbaa !12
switch i8 %6, label %for.inc [
i8 78, label %if.then
i8 83, label %if.then10
i8 87, label %if.then17
i8 69, label %if.then24
]
if.then: ; preds = %for.body
store i32 %0, ptr @t, align 4, !tbaa !5
store i32 %5, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 %2, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
store i32 %4, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
br label %for.inc
if.then10: ; preds = %for.body
store i32 %0, ptr @t, align 4, !tbaa !5
store i32 %4, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 %2, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
store i32 %5, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
br label %for.inc
if.then17: ; preds = %for.body
store i32 %0, ptr @t, align 4, !tbaa !5
store i32 %3, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 %2, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
store i32 %1, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
br label %for.inc
if.then24: ; preds = %for.body
store i32 %0, ptr @t, align 4, !tbaa !5
store i32 %1, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 %2, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
store i32 %3, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
store i32 %0, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then, %if.then17, %if.then24, %if.then10
%7 = phi i32 [ %5, %for.body ], [ %2, %if.then ], [ %5, %if.then17 ], [ %5, %if.then24 ], [ %0, %if.then10 ]
%8 = phi i32 [ %4, %for.body ], [ %0, %if.then ], [ %4, %if.then17 ], [ %4, %if.then24 ], [ %2, %if.then10 ]
%9 = phi i32 [ %3, %for.body ], [ %3, %if.then ], [ %2, %if.then17 ], [ %0, %if.then24 ], [ %3, %if.then10 ]
%10 = phi i32 [ %2, %for.body ], [ %4, %if.then ], [ %1, %if.then17 ], [ %3, %if.then24 ], [ %5, %if.then10 ]
%11 = phi i32 [ %1, %for.body ], [ %1, %if.then ], [ %0, %if.then17 ], [ %2, %if.then24 ], [ %1, %if.then10 ]
%12 = phi i32 [ %0, %for.body ], [ %5, %if.then ], [ %3, %if.then17 ], [ %1, %if.then24 ], [ %4, %if.then10 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %call
br i1 %exitcond.not, label %for.end.loopexit, label %for.body, !llvm.loop !13
for.end.loopexit: ; preds = %for.inc
%13 = trunc i64 %call to i32
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%storemerge.lcssa = phi i32 [ 0, %entry ], [ %13, %for.end.loopexit ]
store i32 %storemerge.lcssa, ptr @i, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
store i32 0, ptr @i, align 4, !tbaa !5
br label %for.body.i
for.cond7.preheader.i: ; preds = %for.body.i
store i32 0, ptr @i, align 4, !tbaa !5
br label %for.body9.i
for.body.i: ; preds = %for.body.i, %entry
%storemerge25.i = phi i32 [ 0, %entry ], [ %add1.i, %for.body.i ]
%add.i = add nsw i32 %storemerge25.i, 1
%idxprom.i = sext i32 %add.i to i64
%arrayidx.i = getelementptr inbounds [7 x i32], ptr @a, i64 0, i64 %idxprom.i
%call.i = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.i)
%0 = load i32, ptr @i, align 4, !tbaa !5
%add1.i = add nsw i32 %0, 1
%idxprom2.i = sext i32 %add1.i to i64
%arrayidx3.i = getelementptr inbounds [7 x i32], ptr @a, i64 0, i64 %idxprom2.i
%1 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%arrayidx6.i = getelementptr inbounds [7 x i32], ptr @b, i64 0, i64 %idxprom2.i
store i32 %1, ptr %arrayidx6.i, align 4, !tbaa !5
store i32 %add1.i, ptr @i, align 4, !tbaa !5
%cmp.i = icmp slt i32 %0, 5
br i1 %cmp.i, label %for.body.i, label %for.cond7.preheader.i, !llvm.loop !9
for.body9.i: ; preds = %for.body9.i, %for.cond7.preheader.i
%storemerge2426.i = phi i32 [ 0, %for.cond7.preheader.i ], [ %add14.i, %for.body9.i ]
%add10.i = add nsw i32 %storemerge2426.i, 1
%idxprom11.i = sext i32 %add10.i to i64
%arrayidx12.i = getelementptr inbounds [7 x i32], ptr @a2, i64 0, i64 %idxprom11.i
%call13.i = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx12.i)
%2 = load i32, ptr @i, align 4, !tbaa !5
%add14.i = add nsw i32 %2, 1
%idxprom15.i = sext i32 %add14.i to i64
%arrayidx16.i = getelementptr inbounds [7 x i32], ptr @a2, i64 0, i64 %idxprom15.i
%3 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%arrayidx19.i = getelementptr inbounds [7 x i32], ptr @b2, i64 0, i64 %idxprom15.i
store i32 %3, ptr %arrayidx19.i, align 4, !tbaa !5
store i32 %add14.i, ptr @i, align 4, !tbaa !5
%cmp8.i = icmp slt i32 %2, 5
br i1 %cmp8.i, label %for.body9.i, label %input.exit, !llvm.loop !11
input.exit: ; preds = %for.body9.i
tail call void @UF()
tail call void @IF()
%4 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
%5 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 1), align 4, !tbaa !5
%cmp3.i = icmp eq i32 %4, %5
%spec.store.select.i = zext i1 %cmp3.i to i32
store i32 %spec.store.select.i, ptr @k, align 4
%6 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
%7 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 2), align 8, !tbaa !5
%cmp3.1.i = icmp eq i32 %6, %7
br i1 %cmp3.1.i, label %if.then.1.i, label %for.inc.1.i
if.then.1.i: ; preds = %input.exit
%inc.1.i = select i1 %cmp3.i, i32 2, i32 1
store i32 %inc.1.i, ptr @k, align 4, !tbaa !5
br label %for.inc.1.i
for.inc.1.i: ; preds = %if.then.1.i, %input.exit
%inc10.1.i = phi i32 [ %spec.store.select.i, %input.exit ], [ %inc.1.i, %if.then.1.i ]
%8 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
%9 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 3), align 4, !tbaa !5
%cmp3.2.i = icmp eq i32 %8, %9
br i1 %cmp3.2.i, label %if.then.2.i, label %for.inc.2.i
if.then.2.i: ; preds = %for.inc.1.i
%inc.2.i = add nuw nsw i32 %inc10.1.i, 1
store i32 %inc.2.i, ptr @k, align 4, !tbaa !5
br label %for.inc.2.i
for.inc.2.i: ; preds = %if.then.2.i, %for.inc.1.i
%inc10.2.i = phi i32 [ %inc10.1.i, %for.inc.1.i ], [ %inc.2.i, %if.then.2.i ]
%10 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
%11 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 4), align 16, !tbaa !5
%cmp3.3.i = icmp eq i32 %10, %11
br i1 %cmp3.3.i, label %if.then.3.i, label %for.inc.3.i
if.then.3.i: ; preds = %for.inc.2.i
%inc.3.i = add nuw nsw i32 %inc10.2.i, 1
store i32 %inc.3.i, ptr @k, align 4, !tbaa !5
br label %for.inc.3.i
for.inc.3.i: ; preds = %if.then.3.i, %for.inc.2.i
%inc10.3.i = phi i32 [ %inc10.2.i, %for.inc.2.i ], [ %inc.3.i, %if.then.3.i ]
%12 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
%13 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 5), align 4, !tbaa !5
%cmp3.4.i = icmp eq i32 %12, %13
br i1 %cmp3.4.i, label %if.then.4.i, label %for.inc.4.i
if.then.4.i: ; preds = %for.inc.3.i
%inc.4.i = add nuw nsw i32 %inc10.3.i, 1
store i32 %inc.4.i, ptr @k, align 4, !tbaa !5
br label %for.inc.4.i
for.inc.4.i: ; preds = %if.then.4.i, %for.inc.3.i
%inc10.4.i = phi i32 [ %inc10.3.i, %for.inc.3.i ], [ %inc.4.i, %if.then.4.i ]
%14 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a, i64 0, i64 6), align 8, !tbaa !5
%15 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @a2, i64 0, i64 6), align 8, !tbaa !5
%cmp3.5.i = icmp eq i32 %14, %15
br i1 %cmp3.5.i, label %for.inc.5.i, label %for.inc.5.thread.i
for.inc.5.thread.i: ; preds = %for.inc.4.i
store i32 7, ptr @i, align 4, !tbaa !5
br label %if.else.i
for.inc.5.i: ; preds = %for.inc.4.i
%inc.5.i = add nuw nsw i32 %inc10.4.i, 1
store i32 %inc.5.i, ptr @k, align 4, !tbaa !5
store i32 7, ptr @i, align 4, !tbaa !5
%cmp5.i = icmp eq i32 %inc.5.i, 6
br i1 %cmp5.i, label %output.exit, label %if.else.i
if.else.i: ; preds = %for.inc.5.i, %for.inc.5.thread.i
br label %output.exit
output.exit: ; preds = %for.inc.5.i, %if.else.i
%str.8.sink.i = phi ptr [ @str.8, %if.else.i ], [ @str.9, %for.inc.5.i ]
%puts.i = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.8.sink.i)
ret i32 0
}
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-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(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree 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 #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nofree nounwind }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<string.h>
void N(int dice[]);
void E(int dice[]);
void S(int dice[]);
void W(int dice[]);
void turn(int dice[]);
int main(void){
int dice1[6],dice2[6],dice3[6];
int i,j,flag=0;
scanf("%d %d %d %d %d %d",&dice1[0],&dice1[1],&dice1[2],&dice1[3],&dice1[4],&dice1[5]);
scanf("%d %d %d %d %d %d",&dice2[0],&dice2[1],&dice2[2],&dice2[3],&dice2[4],&dice2[5]);
for(i=0;i<6;i++){
if(dice1[0]==dice2[i]){
memcpy(dice3,dice2,sizeof(int)*6);
switch(i){
case 0:
break;
case 1:
N(dice3);
break;
case 2:
W(dice3);
break;
case 3:
E(dice3);
break;
case 4:
S(dice3);
break;
case 5:
N(dice3);
N(dice3);
break;
}
for(j=0;j<4;j++){
if(dice1[0]==dice3[0] && dice1[1]==dice3[1] && dice1[2]==dice3[2] && dice1[3]==dice3[3] && dice1[4]==dice3[4] && dice1[5]==dice3[5]){
flag=1;
break;
}
else turn(dice3);
}
}
if(flag==1) break;
}
if(flag==1) printf("Yes\n");
else printf("No\n");
return 0;
}
void N(int dice[]){
int tmp;
tmp=dice[0];
dice[0]=dice[1];
dice[1]=dice[5];
dice[5]=dice[4];
dice[4]=tmp;
}
void E(int dice[]){
int tmp;
tmp=dice[0];
dice[0]=dice[3];
dice[3]=dice[5];
dice[5]=dice[2];
dice[2]=tmp;
}
void S(int dice[]){
int tmp;
tmp=dice[0];
dice[0]=dice[4];
dice[4]=dice[5];
dice[5]=dice[1];
dice[1]=tmp;
}
void W(int dice[]){
int tmp;
tmp=dice[0];
dice[0]=dice[2];
dice[2]=dice[5];
dice[5]=dice[3];
dice[3]=tmp;
}
void turn(int dice[]){
int tmp;
tmp=dice[1];
dice[1]=dice[2];
dice[2]=dice[4];
dice[4]=dice[3];
dice[3]=tmp;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117255/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117255/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = 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:
%dice1 = alloca [6 x i32], align 16
%dice2 = alloca [6 x i32], align 16
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %dice1) #5
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %dice2) #5
%arrayidx1 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 3
%arrayidx4 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 4
%arrayidx5 = getelementptr inbounds [6 x i32], ptr %dice1, i64 0, i64 5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %dice1, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx5)
%arrayidx7 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 1
%arrayidx8 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 2
%arrayidx9 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 3
%arrayidx10 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 4
%arrayidx11 = getelementptr inbounds [6 x i32], ptr %dice2, i64 0, i64 5
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %dice2, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx9, ptr noundef nonnull %arrayidx10, ptr noundef nonnull %arrayidx11)
%0 = load i32, ptr %dice1, align 16, !tbaa !5
%dice3.sroa.0.0.copyload = load i32, ptr %dice2, align 16
%dice3.sroa.16.0.copyload = load i32, ptr %arrayidx7, align 4
%dice3.sroa.27.0.copyload = load i32, ptr %arrayidx8, align 8
%dice3.sroa.34.0.copyload = load i32, ptr %arrayidx9, align 4
%dice3.sroa.41.0.copyload = load i32, ptr %arrayidx10, align 16
%dice3.sroa.52.0.copyload = load i32, ptr %arrayidx11, align 4
%1 = load i32, ptr %arrayidx1, align 4
%2 = load i32, ptr %arrayidx2, align 8
%3 = load i32, ptr %arrayidx3, align 4
%4 = load i32, ptr %arrayidx4, align 16
%5 = load i32, ptr %arrayidx5, align 4
%cmp15 = icmp eq i32 %0, %dice3.sroa.0.0.copyload
br i1 %cmp15, label %sw.epilog, label %for.inc58.critedge
sw.epilog: ; preds = %entry
%cmp51 = icmp eq i32 %5, %dice3.sroa.52.0.copyload
%cmp51.fr = freeze i1 %cmp51
br i1 %cmp51.fr, label %for.body29.preheader, label %for.inc58.critedge
for.body29.preheader: ; preds = %sw.epilog
%cmp35 = icmp eq i32 %1, %dice3.sroa.16.0.copyload
%cmp39 = icmp eq i32 %2, %dice3.sroa.27.0.copyload
%or.cond119 = select i1 %cmp35, i1 %cmp39, i1 false
%cmp43 = icmp eq i32 %3, %dice3.sroa.34.0.copyload
%or.cond120 = select i1 %or.cond119, i1 %cmp43, i1 false
%cmp47 = icmp eq i32 %4, %dice3.sroa.41.0.copyload
%or.cond121 = select i1 %or.cond120, i1 %cmp47, i1 false
br i1 %or.cond121, label %if.then62, label %for.cond27
for.cond27: ; preds = %for.body29.preheader
%cmp35.1 = icmp eq i32 %1, %dice3.sroa.27.0.copyload
%cmp39.1 = icmp eq i32 %2, %dice3.sroa.41.0.copyload
%or.cond119.1 = select i1 %cmp35.1, i1 %cmp39.1, i1 false
%cmp43.1 = icmp eq i32 %3, %dice3.sroa.16.0.copyload
%or.cond120.1 = select i1 %or.cond119.1, i1 %cmp43.1, i1 false
%cmp47.1 = icmp eq i32 %4, %dice3.sroa.34.0.copyload
%or.cond121.1 = select i1 %or.cond120.1, i1 %cmp47.1, i1 false
br i1 %or.cond121.1, label %if.then62, label %for.cond27.1
for.cond27.1: ; preds = %for.cond27
%cmp35.2 = icmp eq i32 %1, %dice3.sroa.41.0.copyload
%cmp39.2 = icmp eq i32 %2, %dice3.sroa.34.0.copyload
%or.cond119.2 = select i1 %cmp35.2, i1 %cmp39.2, i1 false
%cmp43.2 = icmp eq i32 %3, %dice3.sroa.27.0.copyload
%or.cond120.2 = select i1 %or.cond119.2, i1 %cmp43.2, i1 false
%cmp47.2 = icmp eq i32 %4, %dice3.sroa.16.0.copyload
%or.cond121.2 = select i1 %or.cond120.2, i1 %cmp47.2, i1 false
br i1 %or.cond121.2, label %if.then62, label %for.cond27.2
for.cond27.2: ; preds = %for.cond27.1
%cmp35.3 = icmp eq i32 %1, %dice3.sroa.34.0.copyload
%cmp39.3 = icmp eq i32 %2, %dice3.sroa.16.0.copyload
%or.cond119.3 = select i1 %cmp35.3, i1 %cmp39.3, i1 false
%cmp43.3 = icmp eq i32 %3, %dice3.sroa.41.0.copyload
%or.cond120.3 = select i1 %or.cond119.3, i1 %cmp43.3, i1 false
%cmp47.3 = icmp eq i32 %4, %dice3.sroa.27.0.copyload
%or.cond121.3 = select i1 %or.cond120.3, i1 %cmp47.3, i1 false
br i1 %or.cond121.3, label %if.then62, label %for.inc58.critedge
for.inc58.critedge: ; preds = %for.cond27.2, %sw.epilog, %entry
%cmp15.1 = icmp eq i32 %0, %dice3.sroa.16.0.copyload
br i1 %cmp15.1, label %sw.epilog.1, label %for.inc58.critedge.1
sw.epilog.1: ; preds = %for.inc58.critedge
%cmp51.1 = icmp eq i32 %5, %dice3.sroa.41.0.copyload
%cmp51.fr.1 = freeze i1 %cmp51.1
br i1 %cmp51.fr.1, label %for.body29.preheader.1, label %for.inc58.critedge.1
for.body29.preheader.1: ; preds = %sw.epilog.1
%cmp35.1131 = icmp eq i32 %1, %dice3.sroa.52.0.copyload
%cmp39.1132 = icmp eq i32 %2, %dice3.sroa.27.0.copyload
%or.cond119.1133 = select i1 %cmp35.1131, i1 %cmp39.1132, i1 false
%cmp43.1134 = icmp eq i32 %3, %dice3.sroa.34.0.copyload
%or.cond120.1135 = select i1 %or.cond119.1133, i1 %cmp43.1134, i1 false
%cmp47.1136 = icmp eq i32 %4, %dice3.sroa.0.0.copyload
%or.cond121.1137 = select i1 %or.cond120.1135, i1 %cmp47.1136, i1 false
br i1 %or.cond121.1137, label %if.then62, label %for.cond27.1138
for.cond27.1138: ; preds = %for.body29.preheader.1
%cmp35.1.1 = icmp eq i32 %1, %dice3.sroa.27.0.copyload
%cmp39.1.1 = icmp eq i32 %2, %dice3.sroa.0.0.copyload
%or.cond119.1.1 = select i1 %cmp35.1.1, i1 %cmp39.1.1, i1 false
%cmp43.1.1 = icmp eq i32 %3, %dice3.sroa.52.0.copyload
%or.cond120.1.1 = select i1 %or.cond119.1.1, i1 %cmp43.1.1, i1 false
%cmp47.1.1 = icmp eq i32 %4, %dice3.sroa.34.0.copyload
%or.cond121.1.1 = select i1 %or.cond120.1.1, i1 %cmp47.1.1, i1 false
br i1 %or.cond121.1.1, label %if.then62, label %for.cond27.1.1
for.cond27.1.1: ; preds = %for.cond27.1138
%cmp35.2.1 = icmp eq i32 %1, %dice3.sroa.0.0.copyload
%cmp39.2.1 = icmp eq i32 %2, %dice3.sroa.34.0.copyload
%or.cond119.2.1 = select i1 %cmp35.2.1, i1 %cmp39.2.1, i1 false
%cmp43.2.1 = icmp eq i32 %3, %dice3.sroa.27.0.copyload
%or.cond120.2.1 = select i1 %or.cond119.2.1, i1 %cmp43.2.1, i1 false
%cmp47.2.1 = icmp eq i32 %4, %dice3.sroa.52.0.copyload
%or.cond121.2.1 = select i1 %or.cond120.2.1, i1 %cmp47.2.1, i1 false
br i1 %or.cond121.2.1, label %if.then62, label %for.cond27.2.1
for.cond27.2.1: ; preds = %for.cond27.1.1
%cmp35.3.1 = icmp eq i32 %1, %dice3.sroa.34.0.copyload
%cmp39.3.1 = icmp eq i32 %2, %dice3.sroa.52.0.copyload
%or.cond119.3.1 = select i1 %cmp35.3.1, i1 %cmp39.3.1, i1 false
%cmp43.3.1 = icmp eq i32 %3, %dice3.sroa.0.0.copyload
%or.cond120.3.1 = select i1 %or.cond119.3.1, i1 %cmp43.3.1, i1 false
%cmp47.3.1 = icmp eq i32 %4, %dice3.sroa.27.0.copyload
%or.cond121.3.1 = select i1 %or.cond120.3.1, i1 %cmp47.3.1, i1 false
br i1 %or.cond121.3.1, label %if.then62, label %for.inc58.critedge.1
for.inc58.critedge.1: ; preds = %for.cond27.2.1, %sw.epilog.1, %for.inc58.critedge
%cmp15.2 = icmp eq i32 %0, %dice3.sroa.27.0.copyload
br i1 %cmp15.2, label %sw.epilog.2, label %for.inc58.critedge.2
sw.epilog.2: ; preds = %for.inc58.critedge.1
%cmp51.2 = icmp eq i32 %5, %dice3.sroa.34.0.copyload
%cmp51.fr.2 = freeze i1 %cmp51.2
br i1 %cmp51.fr.2, label %for.body29.preheader.2, label %for.inc58.critedge.2
for.body29.preheader.2: ; preds = %sw.epilog.2
%cmp35.2139 = icmp eq i32 %1, %dice3.sroa.16.0.copyload
%cmp39.2140 = icmp eq i32 %2, %dice3.sroa.52.0.copyload
%or.cond119.2141 = select i1 %cmp35.2139, i1 %cmp39.2140, i1 false
%cmp43.2142 = icmp eq i32 %3, %dice3.sroa.0.0.copyload
%or.cond120.2143 = select i1 %or.cond119.2141, i1 %cmp43.2142, i1 false
%cmp47.2144 = icmp eq i32 %4, %dice3.sroa.41.0.copyload
%or.cond121.2145 = select i1 %or.cond120.2143, i1 %cmp47.2144, i1 false
br i1 %or.cond121.2145, label %if.then62, label %for.cond27.2146
for.cond27.2146: ; preds = %for.body29.preheader.2
%cmp35.1.2 = icmp eq i32 %1, %dice3.sroa.52.0.copyload
%cmp39.1.2 = icmp eq i32 %2, %dice3.sroa.41.0.copyload
%or.cond119.1.2 = select i1 %cmp35.1.2, i1 %cmp39.1.2, i1 false
%cmp43.1.2 = icmp eq i32 %3, %dice3.sroa.16.0.copyload
%or.cond120.1.2 = select i1 %or.cond119.1.2, i1 %cmp43.1.2, i1 false
%cmp47.1.2 = icmp eq i32 %4, %dice3.sroa.0.0.copyload
%or.cond121.1.2 = select i1 %or.cond120.1.2, i1 %cmp47.1.2, i1 false
br i1 %or.cond121.1.2, label %if.then62, label %for.cond27.1.2
for.cond27.1.2: ; preds = %for.cond27.2146
%cmp35.2.2 = icmp eq i32 %1, %dice3.sroa.41.0.copyload
%cmp39.2.2 = icmp eq i32 %2, %dice3.sroa.0.0.copyload
%or.cond119.2.2 = select i1 %cmp35.2.2, i1 %cmp39.2.2, i1 false
%cmp43.2.2 = icmp eq i32 %3, %dice3.sroa.52.0.copyload
%or.cond120.2.2 = select i1 %or.cond119.2.2, i1 %cmp43.2.2, i1 false
%cmp47.2.2 = icmp eq i32 %4, %dice3.sroa.16.0.copyload
%or.cond121.2.2 = select i1 %or.cond120.2.2, i1 %cmp47.2.2, i1 false
br i1 %or.cond121.2.2, label %if.then62, label %for.cond27.2.2
for.cond27.2.2: ; preds = %for.cond27.1.2
%cmp35.3.2 = icmp eq i32 %1, %dice3.sroa.0.0.copyload
%cmp39.3.2 = icmp eq i32 %2, %dice3.sroa.16.0.copyload
%or.cond119.3.2 = select i1 %cmp35.3.2, i1 %cmp39.3.2, i1 false
%cmp43.3.2 = icmp eq i32 %3, %dice3.sroa.41.0.copyload
%or.cond120.3.2 = select i1 %or.cond119.3.2, i1 %cmp43.3.2, i1 false
%cmp47.3.2 = icmp eq i32 %4, %dice3.sroa.52.0.copyload
%or.cond121.3.2 = select i1 %or.cond120.3.2, i1 %cmp47.3.2, i1 false
br i1 %or.cond121.3.2, label %if.then62, label %for.inc58.critedge.2
for.inc58.critedge.2: ; preds = %for.cond27.2.2, %sw.epilog.2, %for.inc58.critedge.1
%cmp15.3 = icmp eq i32 %0, %dice3.sroa.34.0.copyload
br i1 %cmp15.3, label %sw.epilog.3, label %for.inc58.critedge.3
sw.epilog.3: ; preds = %for.inc58.critedge.2
%cmp51.3 = icmp eq i32 %5, %dice3.sroa.27.0.copyload
%cmp51.fr.3 = freeze i1 %cmp51.3
br i1 %cmp51.fr.3, label %for.body29.preheader.3, label %for.inc58.critedge.3
for.body29.preheader.3: ; preds = %sw.epilog.3
%cmp35.3147 = icmp eq i32 %1, %dice3.sroa.16.0.copyload
%cmp39.3148 = icmp eq i32 %2, %dice3.sroa.0.0.copyload
%or.cond119.3149 = select i1 %cmp35.3147, i1 %cmp39.3148, i1 false
%cmp43.3150 = icmp eq i32 %3, %dice3.sroa.52.0.copyload
%or.cond120.3151 = select i1 %or.cond119.3149, i1 %cmp43.3150, i1 false
%cmp47.3152 = icmp eq i32 %4, %dice3.sroa.41.0.copyload
%or.cond121.3153 = select i1 %or.cond120.3151, i1 %cmp47.3152, i1 false
br i1 %or.cond121.3153, label %if.then62, label %for.cond27.3154
for.cond27.3154: ; preds = %for.body29.preheader.3
%cmp35.1.3 = icmp eq i32 %1, %dice3.sroa.0.0.copyload
%cmp39.1.3 = icmp eq i32 %2, %dice3.sroa.41.0.copyload
%or.cond119.1.3 = select i1 %cmp35.1.3, i1 %cmp39.1.3, i1 false
%cmp43.1.3 = icmp eq i32 %3, %dice3.sroa.16.0.copyload
%or.cond120.1.3 = select i1 %or.cond119.1.3, i1 %cmp43.1.3, i1 false
%cmp47.1.3 = icmp eq i32 %4, %dice3.sroa.52.0.copyload
%or.cond121.1.3 = select i1 %or.cond120.1.3, i1 %cmp47.1.3, i1 false
br i1 %or.cond121.1.3, label %if.then62, label %for.cond27.1.3
for.cond27.1.3: ; preds = %for.cond27.3154
%cmp35.2.3 = icmp eq i32 %1, %dice3.sroa.41.0.copyload
%cmp39.2.3 = icmp eq i32 %2, %dice3.sroa.52.0.copyload
%or.cond119.2.3 = select i1 %cmp35.2.3, i1 %cmp39.2.3, i1 false
%cmp43.2.3 = icmp eq i32 %3, %dice3.sroa.0.0.copyload
%or.cond120.2.3 = select i1 %or.cond119.2.3, i1 %cmp43.2.3, i1 false
%cmp47.2.3 = icmp eq i32 %4, %dice3.sroa.16.0.copyload
%or.cond121.2.3 = select i1 %or.cond120.2.3, i1 %cmp47.2.3, i1 false
br i1 %or.cond121.2.3, label %if.then62, label %for.cond27.2.3
for.cond27.2.3: ; preds = %for.cond27.1.3
%cmp35.3.3 = icmp eq i32 %1, %dice3.sroa.52.0.copyload
%cmp39.3.3 = icmp eq i32 %2, %dice3.sroa.16.0.copyload
%or.cond119.3.3 = select i1 %cmp35.3.3, i1 %cmp39.3.3, i1 false
%cmp43.3.3 = icmp eq i32 %3, %dice3.sroa.41.0.copyload
%or.cond120.3.3 = select i1 %or.cond119.3.3, i1 %cmp43.3.3, i1 false
%cmp47.3.3 = icmp eq i32 %4, %dice3.sroa.0.0.copyload
%or.cond121.3.3 = select i1 %or.cond120.3.3, i1 %cmp47.3.3, i1 false
br i1 %or.cond121.3.3, label %if.then62, label %for.inc58.critedge.3
for.inc58.critedge.3: ; preds = %for.cond27.2.3, %sw.epilog.3, %for.inc58.critedge.2
%cmp15.4 = icmp eq i32 %0, %dice3.sroa.41.0.copyload
br i1 %cmp15.4, label %sw.epilog.4, label %for.inc58.critedge.4
sw.epilog.4: ; preds = %for.inc58.critedge.3
%cmp51.4 = icmp eq i32 %5, %dice3.sroa.16.0.copyload
%cmp51.fr.4 = freeze i1 %cmp51.4
br i1 %cmp51.fr.4, label %for.body29.preheader.4, label %for.inc58.critedge.4
for.body29.preheader.4: ; preds = %sw.epilog.4
%cmp35.4 = icmp eq i32 %1, %dice3.sroa.0.0.copyload
%cmp39.4 = icmp eq i32 %2, %dice3.sroa.27.0.copyload
%or.cond119.4 = select i1 %cmp35.4, i1 %cmp39.4, i1 false
%cmp43.4 = icmp eq i32 %3, %dice3.sroa.34.0.copyload
%or.cond120.4 = select i1 %or.cond119.4, i1 %cmp43.4, i1 false
%cmp47.4 = icmp eq i32 %4, %dice3.sroa.52.0.copyload
%or.cond121.4 = select i1 %or.cond120.4, i1 %cmp47.4, i1 false
br i1 %or.cond121.4, label %if.then62, label %for.cond27.4
for.cond27.4: ; preds = %for.body29.preheader.4
%cmp35.1.4 = icmp eq i32 %1, %dice3.sroa.27.0.copyload
%cmp39.1.4 = icmp eq i32 %2, %dice3.sroa.52.0.copyload
%or.cond119.1.4 = select i1 %cmp35.1.4, i1 %cmp39.1.4, i1 false
%cmp43.1.4 = icmp eq i32 %3, %dice3.sroa.0.0.copyload
%or.cond120.1.4 = select i1 %or.cond119.1.4, i1 %cmp43.1.4, i1 false
%cmp47.1.4 = icmp eq i32 %4, %dice3.sroa.34.0.copyload
%or.cond121.1.4 = select i1 %or.cond120.1.4, i1 %cmp47.1.4, i1 false
br i1 %or.cond121.1.4, label %if.then62, label %for.cond27.1.4
for.cond27.1.4: ; preds = %for.cond27.4
%cmp35.2.4 = icmp eq i32 %1, %dice3.sroa.52.0.copyload
%cmp39.2.4 = icmp eq i32 %2, %dice3.sroa.34.0.copyload
%or.cond119.2.4 = select i1 %cmp35.2.4, i1 %cmp39.2.4, i1 false
%cmp43.2.4 = icmp eq i32 %3, %dice3.sroa.27.0.copyload
%or.cond120.2.4 = select i1 %or.cond119.2.4, i1 %cmp43.2.4, i1 false
%cmp47.2.4 = icmp eq i32 %4, %dice3.sroa.0.0.copyload
%or.cond121.2.4 = select i1 %or.cond120.2.4, i1 %cmp47.2.4, i1 false
br i1 %or.cond121.2.4, label %if.then62, label %for.cond27.2.4
for.cond27.2.4: ; preds = %for.cond27.1.4
%cmp35.3.4 = icmp eq i32 %1, %dice3.sroa.34.0.copyload
%cmp39.3.4 = icmp eq i32 %2, %dice3.sroa.0.0.copyload
%or.cond119.3.4 = select i1 %cmp35.3.4, i1 %cmp39.3.4, i1 false
%cmp43.3.4 = icmp eq i32 %3, %dice3.sroa.52.0.copyload
%or.cond120.3.4 = select i1 %or.cond119.3.4, i1 %cmp43.3.4, i1 false
%cmp47.3.4 = icmp eq i32 %4, %dice3.sroa.27.0.copyload
%or.cond121.3.4 = select i1 %or.cond120.3.4, i1 %cmp47.3.4, i1 false
br i1 %or.cond121.3.4, label %if.then62, label %for.inc58.critedge.4
for.inc58.critedge.4: ; preds = %for.cond27.2.4, %sw.epilog.4, %for.inc58.critedge.3
%cmp15.5 = icmp eq i32 %0, %dice3.sroa.52.0.copyload
br i1 %cmp15.5, label %sw.epilog.5, label %if.end66
sw.epilog.5: ; preds = %for.inc58.critedge.4
%cmp51.5 = icmp eq i32 %5, %dice3.sroa.0.0.copyload
%cmp51.fr.5 = freeze i1 %cmp51.5
br i1 %cmp51.fr.5, label %for.body29.preheader.5, label %if.end66
for.body29.preheader.5: ; preds = %sw.epilog.5
%cmp35.5 = icmp eq i32 %1, %dice3.sroa.41.0.copyload
%cmp39.5 = icmp eq i32 %2, %dice3.sroa.27.0.copyload
%or.cond119.5 = select i1 %cmp35.5, i1 %cmp39.5, i1 false
%cmp43.5 = icmp eq i32 %3, %dice3.sroa.34.0.copyload
%or.cond120.5 = select i1 %or.cond119.5, i1 %cmp43.5, i1 false
%cmp47.5 = icmp eq i32 %4, %dice3.sroa.16.0.copyload
%or.cond121.5 = select i1 %or.cond120.5, i1 %cmp47.5, i1 false
br i1 %or.cond121.5, label %if.then62, label %for.cond27.5
for.cond27.5: ; preds = %for.body29.preheader.5
%cmp35.1.5 = icmp eq i32 %1, %dice3.sroa.27.0.copyload
%cmp39.1.5 = icmp eq i32 %2, %dice3.sroa.16.0.copyload
%or.cond119.1.5 = select i1 %cmp35.1.5, i1 %cmp39.1.5, i1 false
%cmp43.1.5 = icmp eq i32 %3, %dice3.sroa.41.0.copyload
%or.cond120.1.5 = select i1 %or.cond119.1.5, i1 %cmp43.1.5, i1 false
%cmp47.1.5 = icmp eq i32 %4, %dice3.sroa.34.0.copyload
%or.cond121.1.5 = select i1 %or.cond120.1.5, i1 %cmp47.1.5, i1 false
br i1 %or.cond121.1.5, label %if.then62, label %for.cond27.1.5
for.cond27.1.5: ; preds = %for.cond27.5
%cmp35.2.5 = icmp eq i32 %1, %dice3.sroa.16.0.copyload
%cmp39.2.5 = icmp eq i32 %2, %dice3.sroa.34.0.copyload
%or.cond119.2.5 = select i1 %cmp35.2.5, i1 %cmp39.2.5, i1 false
%cmp43.2.5 = icmp eq i32 %3, %dice3.sroa.27.0.copyload
%or.cond120.2.5 = select i1 %or.cond119.2.5, i1 %cmp43.2.5, i1 false
%cmp47.2.5 = icmp eq i32 %4, %dice3.sroa.41.0.copyload
%or.cond121.2.5 = select i1 %or.cond120.2.5, i1 %cmp47.2.5, i1 false
br i1 %or.cond121.2.5, label %if.then62, label %for.cond27.2.5
for.cond27.2.5: ; preds = %for.cond27.1.5
%cmp35.3.5 = icmp eq i32 %1, %dice3.sroa.34.0.copyload
%cmp39.3.5 = icmp eq i32 %2, %dice3.sroa.41.0.copyload
%or.cond119.3.5 = select i1 %cmp35.3.5, i1 %cmp39.3.5, i1 false
%cmp43.3.5 = icmp eq i32 %3, %dice3.sroa.16.0.copyload
%or.cond120.3.5 = select i1 %or.cond119.3.5, i1 %cmp43.3.5, i1 false
%cmp47.3.5 = icmp eq i32 %4, %dice3.sroa.27.0.copyload
%or.cond121.3.5 = select i1 %or.cond120.3.5, i1 %cmp47.3.5, i1 false
br i1 %or.cond121.3.5, label %if.then62, label %if.end66
if.then62: ; preds = %for.cond27.2.5, %for.cond27.1.5, %for.cond27.5, %for.body29.preheader.5, %for.cond27.2.4, %for.cond27.1.4, %for.cond27.4, %for.body29.preheader.4, %for.cond27.2.3, %for.cond27.1.3, %for.cond27.3154, %for.body29.preheader.3, %for.cond27.2.2, %for.cond27.1.2, %for.cond27.2146, %for.body29.preheader.2, %for.cond27.2.1, %for.cond27.1.1, %for.cond27.1138, %for.body29.preheader.1, %for.cond27.2, %for.cond27.1, %for.cond27, %for.body29.preheader
br label %if.end66
if.end66: ; preds = %for.inc58.critedge.4, %sw.epilog.5, %for.cond27.2.5, %if.then62
%str.sink = phi ptr [ @str.3, %if.then62 ], [ @str, %for.cond27.2.5 ], [ @str, %sw.epilog.5 ], [ @str, %for.inc58.critedge.4 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %dice2) #5
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %dice1) #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 norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @N(ptr nocapture noundef %dice) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %dice, align 4, !tbaa !5
%arrayidx1 = getelementptr inbounds i32, ptr %dice, i64 1
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
store i32 %1, ptr %dice, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds i32, ptr %dice, i64 5
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
store i32 %2, ptr %arrayidx1, align 4, !tbaa !5
%arrayidx5 = getelementptr inbounds i32, ptr %dice, i64 4
%3 = load i32, ptr %arrayidx5, align 4, !tbaa !5
store i32 %3, ptr %arrayidx3, align 4, !tbaa !5
store i32 %0, ptr %arrayidx5, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @W(ptr nocapture noundef %dice) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %dice, align 4, !tbaa !5
%arrayidx1 = getelementptr inbounds i32, ptr %dice, i64 2
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
store i32 %1, ptr %dice, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds i32, ptr %dice, i64 5
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
store i32 %2, ptr %arrayidx1, align 4, !tbaa !5
%arrayidx5 = getelementptr inbounds i32, ptr %dice, i64 3
%3 = load i32, ptr %arrayidx5, align 4, !tbaa !5
store i32 %3, ptr %arrayidx3, align 4, !tbaa !5
store i32 %0, ptr %arrayidx5, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @E(ptr nocapture noundef %dice) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %dice, align 4, !tbaa !5
%arrayidx1 = getelementptr inbounds i32, ptr %dice, i64 3
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
store i32 %1, ptr %dice, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds i32, ptr %dice, i64 5
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
store i32 %2, ptr %arrayidx1, align 4, !tbaa !5
%arrayidx5 = getelementptr inbounds i32, ptr %dice, i64 2
%3 = load i32, ptr %arrayidx5, align 4, !tbaa !5
store i32 %3, ptr %arrayidx3, align 4, !tbaa !5
store i32 %0, ptr %arrayidx5, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @S(ptr nocapture noundef %dice) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %dice, align 4, !tbaa !5
%arrayidx1 = getelementptr inbounds i32, ptr %dice, i64 4
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
store i32 %1, ptr %dice, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds i32, ptr %dice, i64 5
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
store i32 %2, ptr %arrayidx1, align 4, !tbaa !5
%arrayidx5 = getelementptr inbounds i32, ptr %dice, i64 1
%3 = load i32, ptr %arrayidx5, align 4, !tbaa !5
store i32 %3, ptr %arrayidx3, align 4, !tbaa !5
store i32 %0, ptr %arrayidx5, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @turn(ptr nocapture noundef %dice) local_unnamed_addr #3 {
entry:
%arrayidx = getelementptr inbounds i32, ptr %dice, i64 1
%0 = load <4 x i32>, ptr %arrayidx, align 4, !tbaa !5
%1 = shufflevector <4 x i32> %0, <4 x i32> poison, <4 x i32> <i32 1, i32 3, i32 0, i32 2>
store <4 x i32> %1, ptr %arrayidx, align 4, !tbaa !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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main(void){
long long int a,b,c,na,nb,nc;
double m = pow(10,9);
int i=0;
scanf("%lld %lld %lld", &a, &b, &c);
while(1){
if(a%2 || b%2 || c%2) break;
if(a==b && b==c){
printf("-1\n");
return 0;
}
na = b/2+c/2;
nb = a/2+c/2;
nc = a/2+b/2;
a=na;b=nb;c=nc;
i++;
}
printf("%d", i);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117299/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117299/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%lld %lld %lld\00", align 1
@.str.2 = 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 i32 @main() local_unnamed_addr #0 {
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) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%a.promoted = load i64, ptr %a, align 8, !tbaa !5
%0 = and i64 %a.promoted, 1
%tobool.not31 = icmp eq i64 %0, 0
br i1 %tobool.not31, label %lor.lhs.false.preheader, label %while.end
lor.lhs.false.preheader: ; preds = %entry
%c.promoted = load i64, ptr %c, align 8, !tbaa !5
%b.promoted = load i64, ptr %b, align 8, !tbaa !5
br label %lor.lhs.false
lor.lhs.false: ; preds = %lor.lhs.false.preheader, %if.end10
%i.035 = phi i32 [ %inc, %if.end10 ], [ 0, %lor.lhs.false.preheader ]
%add2834 = phi i64 [ %add, %if.end10 ], [ %a.promoted, %lor.lhs.false.preheader ]
%add142933 = phi i64 [ %add14, %if.end10 ], [ %b.promoted, %lor.lhs.false.preheader ]
%add173032 = phi i64 [ %add17, %if.end10 ], [ %c.promoted, %lor.lhs.false.preheader ]
%1 = and i64 %add142933, 1
%tobool3.not = icmp eq i64 %1, 0
%2 = and i64 %add173032, 1
%tobool6.not = icmp eq i64 %2, 0
%or.cond38 = select i1 %tobool3.not, i1 %tobool6.not, i1 false
br i1 %or.cond38, label %if.end, label %while.end
if.end: ; preds = %lor.lhs.false
%cmp = icmp eq i64 %add2834, %add142933
%cmp7 = icmp eq i64 %add142933, %add173032
%or.cond = and i1 %cmp, %cmp7
br i1 %or.cond, label %if.then8, label %if.end10
if.then8: ; preds = %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
if.end10: ; preds = %if.end
%div = sdiv i64 %add142933, 2
%div11 = sdiv i64 %add173032, 2
%add = add nsw i64 %div11, %div
%div12 = sdiv i64 %add2834, 2
%add14 = add nsw i64 %div11, %div12
%add17 = add nsw i64 %div, %div12
store i64 %add, ptr %a, align 8, !tbaa !5
store i64 %add14, ptr %b, align 8, !tbaa !5
store i64 %add17, ptr %c, align 8, !tbaa !5
%inc = add nuw nsw i32 %i.035, 1
%3 = and i64 %add, 1
%tobool.not = icmp eq i64 %3, 0
br i1 %tobool.not, label %lor.lhs.false, label %while.end
while.end: ; preds = %lor.lhs.false, %if.end10, %entry
%i.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %if.end10 ], [ %i.035, %lor.lhs.false ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.0.lcssa)
br label %cleanup
cleanup: ; preds = %while.end, %if.then8
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int a,b,c,num=0,a1,b1,c1,f=1;
scanf("%d%d%d",&a,&b,&c);
while(a%2==0 && b%2==0 && c%2==0){
a1=a/2;
b1=b/2;
c1=c/2;
a=b1+c1;
b=a1+c1;
c=a1+b1;
num++;
if(a==b && b==c){
f=0;
printf("-1\n");
break;
}
}
if(f==1)printf("%d\n",num);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117341/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117341/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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)
%a.promoted = load i32, ptr %a, align 4, !tbaa !5
%b.promoted = load i32, ptr %b, align 4, !tbaa !5
%c.promoted = load i32, ptr %c, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.body, %entry
%add827 = phi i32 [ %c.promoted, %entry ], [ %add8, %while.body ]
%add726 = phi i32 [ %b.promoted, %entry ], [ %add7, %while.body ]
%add25 = phi i32 [ %a.promoted, %entry ], [ %add, %while.body ]
%num.0 = phi i32 [ 0, %entry ], [ %inc, %while.body ]
%0 = and i32 %add25, 1
%cmp = icmp eq i32 %0, 0
%1 = and i32 %add726, 1
%cmp2 = icmp eq i32 %1, 0
%or.cond28 = select i1 %cmp, i1 %cmp2, i1 false
%2 = and i32 %add827, 1
%cmp4 = icmp eq i32 %2, 0
%or.cond29 = select i1 %or.cond28, i1 %cmp4, i1 false
br i1 %or.cond29, label %while.body, label %if.then14
while.body: ; preds = %while.cond
%div = sdiv i32 %add25, 2
%div5 = sdiv i32 %add726, 2
%div6 = sdiv i32 %add827, 2
%add = add nsw i32 %div6, %div5
store i32 %add, ptr %a, align 4, !tbaa !5
%add7 = add nsw i32 %div6, %div
store i32 %add7, ptr %b, align 4, !tbaa !5
%add8 = add nsw i32 %div5, %div
store i32 %add8, ptr %c, align 4, !tbaa !5
%inc = add nuw nsw i32 %num.0, 1
%cmp9 = icmp eq i32 %div5, %div
%cmp11 = icmp eq i32 %div6, %div5
%or.cond = and i1 %cmp9, %cmp11
br i1 %or.cond, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end16
if.then14: ; preds = %while.cond
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %num.0)
br label %if.end16
if.end16: ; preds = %while.end, %if.then14
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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#define MOD 1000000007
#define END printf("\n");return 0;
#define QS09(how_data,data) qsort(data,how_data,sizeof(long),(int (*)(const void *,const void *))qsort_09);
#define QS90(how_data,data) qsort(data,how_data,sizeof(long),(int (*)(const void *,const void *))qsort_90);
#define I(a) long a;scanf("%ld",&a);
void input_array(long how_data,long *data);
void output_array(long how_data,long *data);
void input_array2(long first , long second , long data[][2]);
void format_array(long how_data ,long *data,long what);
long get_random(long min, long max);
long factorial(long n);
long fibonacci(long n);
int qsort_09(const int *sys1 , const int *sys2);
int qsort_90(const int *sys1 , const int *sys2);
long sel_max(long a , long b);
long sel_min(long a , long b);
long array_max(long how_data,long *data);
long array_min(long how_data,long *data);
long can_DP(long how_data,long *data,long how_can,bool *can);
long array_sum(long how_data,long *data);
long Leven_dist(char *now , char *target);
void prime_fact(long target, long *data);
long get_digit(long target);
long ncr(long n , long r);
long npr(long n , long r);
long nhr(long n , long r);
long loop1,loop2,loop3,loop4,loop5,i_temp;
char c_temp;
int main(void){
I(a);I(b);I(c);
long ans=0;
while(1){
if(a%2==1 || b%2==1 || c%2==1){
printf("%ld\n",ans);
END;
}
long temp_a=a;
long temp_b=b;
long temp_c=c;
a=temp_b/2+temp_c/2;
b=temp_a/2+temp_c/2;
c=temp_a/2+temp_b/2;
ans++;
if(ans>400000000){
printf("-1\n");
END;
}
}
END;
}
void input_array(long how_data,long *data){
long loop;
for(loop=0;loop<how_data;loop++){
scanf("%ld",&data[loop]);
}
return ;
}
void output_array(long how_data,long *data){
long loop;
for(loop=0;loop<how_data;loop++){
printf("%ld ",data[loop]);
}
return ;
}
void input_array2(long first,long second,long data[][2]){
long loopA,loopB;
for(loopA=0;loopA<first;loopA++){
for(loopB=0;loopB<second;loopB++){
scanf("%ld",&data[loopA][loopB]);
}
}
return ;
}
void format_array(long how_data ,long *data,long what){
long loopA;
for(loopA=0;loopA<how_data;loopA++){
data[loopA]=what;
}
return ;
}
long get_random(long min, long max){ //指定の範囲から乱数を1つ返すやつ
//srand((unsigned int)time(0)); //現在時刻で疑似乱数初期化
rand();rand();rand();rand(); //乱数を空打ち
return (rand()%(max+1-min))+min;
}
long factorial(long n){//n!のMOD10^9+7を返すやつ
unsigned long long int ret=1;
for(long i=1;i<=n;i++)ret=(ret*i)%1000000007;
return (long)ret;
}
int qsort_09(const int *sys1 , const int *sys2){ //小さいのが上にくるやつ
//qsort(data,how_data,sizeof(long),(int (*)(const void *,const void *))qsort_09);
if(*sys1<*sys2){
return -1;
}else if(*sys1==*sys2){
return 0;
}else{
return 1;
}
}
int qsort_90(const int *sys1 , const int *sys2){ //大きいのが上にくるやつ
//qsort(data,how_data,sizeof(long),(int (*)(const void *,const void *))qsort_90);
if(*sys1<*sys2){
return 1;
}else if(*sys1==*sys2){
return 0;
}else{
return -1;
}
}
long fibonacci(long n){
switch(n){
case 0:return 0;
case 1:return 1;
default :return fibonacci(n-1)+fibonacci(n-2);
}
}
long sel_max(long a,long b){
if(a>b)return a;
return b;
}
long sel_min(long a,long b){
if(a>b)return b;
return a;
}
long can_DP(long how_data,long *data,long how_can,bool *can){//Typical DP Contest A
//data内で組み合わせられる和をcanに0 or 1で入れる
//返り値はパターン数
long loopA,loopB;
long ret=0;
for(loopA=0;loopA<how_can;loopA++){//初期化
can[loopA]=0;
}
can[0]=1;//絶対にありえる
for(loopA=0;loopA<how_data;loopA++){
for(loopB=how_can-1;loopB>=0;loopB--){
if(can[loopB]==1 && loopB+data[loopA]<how_can){
can[loopB+data[loopA]]=1;
}
}
}
for(loopA=0;loopA<how_can;loopA++){
if(can[loopA]==1){
ret++;
}
}
return ret;
}
long array_max(long how_data,long *data){
long loop;
long ret=data[0];
for(loop=0;loop<how_data;loop++){
if(ret<data[loop])ret=data[loop];
}
return ret;
}
long array_min(long how_data,long *data){
long loop;
long ret=data[0];
for(loop=0;loop<how_data;loop++){
if(ret>data[loop])ret=data[loop];
}
return ret;
}
long array_sum(long how_data,long *data){
long ret=0;
long loop;
for(loop=0;loop<how_data;loop++){
ret+=data[loop];
}
return ret;
}
long Leven_dist(char *now , char *target){
long loopA,loopB;
//レーベンシュタイン距離を求める
// 参考文献
// http://nw.tsuda.ac.jp/class/algoB/c13.html (アルゴリズム理解)
// http://d.hatena.ne.jp/ohnishiakira/20090809/1249845529 (実装)
long len_now=strlen(now)+1;
long len_target=strlen(target)+1;
long d[len_now][len_target]; //計算用
for(loopA=0;loopA<len_now;loopA++) d[loopA][0]=loopA;
for(loopA=0;loopA<len_target;loopA++) d[0][loopA]=loopA;
for(loopA=1;loopA<len_now;loopA++){
for(loopB=1;loopB<len_target;loopB++){
long cost=(now[loopA-1]==target[loopB-1] ? 0:1);
d[loopA][loopB]=sel_min(sel_min(d[loopA-1][loopB]+1,d[loopA][loopB-1]+1),d[loopA-1][loopB-1]+cost);
}
}
return d[len_now-1][len_target-1];
}
void prime_fact(long target, long *data){
long loopB=0;
long loopA=2;
long moto_target=target;
while(target!=1){
loopA-=1;
while(1){
loopA++;
if(loopA>=sqrt(moto_target)+100){
data[loopB]=target;
target=1;
break;
}
if(target%loopA==0){
data[loopB]=loopA;
target/=loopA;
loopB++;
break;
}
}
}
return ;
}
long get_digit(long target){
return (long)(log10(target)+1);
}
long ncr(long n , long r){
//パスカルの三角形
long loopA,loopB;
long pascal[100][102]={{0}};
pascal[1][0]=1;
pascal[1][1]=1;
for(loopA=2;loopA<100;loopA++){
pascal[loopA][0]=1;
for(loopB=1;loopB<loopA;loopB++){
pascal[loopA][loopB]=pascal[loopA-1][loopB-1]+pascal[loopA-1][loopB];
}
pascal[loopA][loopA]=1;
}
return pascal[n][r];
}
long npr(long n, long r){
return ncr(n,r)*factorial(r);
}
long nhr(long n , long r){
return ncr(n+r-1,r);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117385/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117385/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"%ld\0A\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"%ld \00", align 1
@loop1 = dso_local local_unnamed_addr global i64 0, align 8
@loop2 = dso_local local_unnamed_addr global i64 0, align 8
@loop3 = dso_local local_unnamed_addr global i64 0, align 8
@loop4 = dso_local local_unnamed_addr global i64 0, align 8
@loop5 = dso_local local_unnamed_addr global i64 0, align 8
@i_temp = dso_local local_unnamed_addr global i64 0, align 8
@c_temp = dso_local local_unnamed_addr global i8 0, align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #21
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #21
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #21
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%a.promoted = load i64, ptr %a, align 8, !tbaa !5
%b.promoted = load i64, ptr %b, align 8, !tbaa !5
%c.promoted = load i64, ptr %c, align 8, !tbaa !5
br label %while.cond
while.cond: ; preds = %if.end, %entry
%add1637 = phi i64 [ %c.promoted, %entry ], [ %add16, %if.end ]
%add1336 = phi i64 [ %b.promoted, %entry ], [ %add13, %if.end ]
%add35 = phi i64 [ %a.promoted, %entry ], [ %add, %if.end ]
%ans.0 = phi i64 [ 0, %entry ], [ %inc, %if.end ]
%0 = and i64 %add35, -9223372036854775807
%cmp = icmp eq i64 %0, 1
%1 = and i64 %add1336, -9223372036854775807
%cmp4 = icmp eq i64 %1, 1
%or.cond = select i1 %cmp, i1 true, i1 %cmp4
%2 = and i64 %add1637, -9223372036854775807
%cmp7 = icmp eq i64 %2, 1
%or.cond38 = select i1 %or.cond, i1 true, i1 %cmp7
br i1 %or.cond38, label %if.then, label %if.end
if.then: ; preds = %while.cond
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0)
br label %cleanup24
if.end: ; preds = %while.cond
%div = sdiv i64 %add1336, 2
%div10 = sdiv i64 %add1637, 2
%add = add nsw i64 %div10, %div
store i64 %add, ptr %a, align 8, !tbaa !5
%div11 = sdiv i64 %add35, 2
%add13 = add nsw i64 %div10, %div11
store i64 %add13, ptr %b, align 8, !tbaa !5
%add16 = add nsw i64 %div, %div11
store i64 %add16, ptr %c, align 8, !tbaa !5
%inc = add nuw nsw i64 %ans.0, 1
%exitcond.not = icmp eq i64 %inc, 400000001
br i1 %exitcond.not, label %if.then18, label %while.cond
if.then18: ; preds = %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup24
cleanup24: ; preds = %if.then18, %if.then
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #21
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #21
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #21
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 uwtable
define dso_local void @input_array(i64 noundef %how_data, ptr noundef %data) local_unnamed_addr #0 {
entry:
%cmp3 = icmp sgt i64 %how_data, 0
br i1 %cmp3, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%loop.04 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %data, i64 %loop.04
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%inc = add nuw nsw i64 %loop.04, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @output_array(i64 noundef %how_data, ptr nocapture noundef readonly %data) local_unnamed_addr #0 {
entry:
%cmp3 = icmp sgt i64 %how_data, 0
br i1 %cmp3, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%loop.04 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %data, i64 %loop.04
%0 = load i64, ptr %arrayidx, align 8, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %0)
%inc = add nuw nsw i64 %loop.04, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @input_array2(i64 noundef %first, i64 noundef %second, ptr noundef %data) local_unnamed_addr #0 {
entry:
%cmp14 = icmp sgt i64 %first, 0
%cmp212 = icmp sgt i64 %second, 0
%or.cond = and i1 %cmp14, %cmp212
br i1 %or.cond, label %for.cond1.preheader.us, label %for.end7
for.cond1.preheader.us: ; preds = %entry, %for.cond1.for.inc5_crit_edge.us
%loopA.015.us = phi i64 [ %inc6.us, %for.cond1.for.inc5_crit_edge.us ], [ 0, %entry ]
br label %for.body3.us
for.body3.us: ; preds = %for.cond1.preheader.us, %for.body3.us
%loopB.013.us = phi i64 [ 0, %for.cond1.preheader.us ], [ %inc.us, %for.body3.us ]
%arrayidx4.us = getelementptr inbounds [2 x i64], ptr %data, i64 %loopA.015.us, i64 %loopB.013.us
%call.us = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx4.us)
%inc.us = add nuw nsw i64 %loopB.013.us, 1
%exitcond.not = icmp eq i64 %inc.us, %second
br i1 %exitcond.not, label %for.cond1.for.inc5_crit_edge.us, label %for.body3.us, !llvm.loop !12
for.cond1.for.inc5_crit_edge.us: ; preds = %for.body3.us
%inc6.us = add nuw nsw i64 %loopA.015.us, 1
%exitcond17.not = icmp eq i64 %inc6.us, %first
br i1 %exitcond17.not, label %for.end7, label %for.cond1.preheader.us, !llvm.loop !13
for.end7: ; preds = %for.cond1.for.inc5_crit_edge.us, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: write) uwtable
define dso_local void @format_array(i64 noundef %how_data, ptr nocapture noundef writeonly %data, i64 noundef %what) local_unnamed_addr #3 {
entry:
%cmp3 = icmp sgt i64 %how_data, 0
br i1 %cmp3, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %how_data, 4
br i1 %min.iters.check, label %for.body.preheader5, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %how_data, -4
%broadcast.splatinsert = insertelement <2 x i64> poison, i64 %what, i64 0
%broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%0 = getelementptr inbounds i64, ptr %data, i64 %index
store <2 x i64> %broadcast.splat, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
store <2 x i64> %broadcast.splat, ptr %1, align 8, !tbaa !5
%index.next = add nuw i64 %index, 4
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %how_data
br i1 %cmp.n, label %for.end, label %for.body.preheader5
for.body.preheader5: ; preds = %for.body.preheader, %middle.block
%loopA.04.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader5, %for.body
%loopA.04 = phi i64 [ %inc, %for.body ], [ %loopA.04.ph, %for.body.preheader5 ]
%arrayidx = getelementptr inbounds i64, ptr %data, i64 %loopA.04
store i64 %what, ptr %arrayidx, align 8, !tbaa !5
%inc = add nuw nsw i64 %loopA.04, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !17
for.end: ; preds = %for.body, %middle.block, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i64 @get_random(i64 noundef %min, i64 noundef %max) local_unnamed_addr #4 {
entry:
%call = tail call i32 @rand() #21
%call1 = tail call i32 @rand() #21
%call2 = tail call i32 @rand() #21
%call3 = tail call i32 @rand() #21
%call4 = tail call i32 @rand() #21
%conv = sext i32 %call4 to i64
%reass.sub = sub i64 %max, %min
%sub = add i64 %reass.sub, 1
%rem = srem i64 %conv, %sub
%add5 = add nsw i64 %rem, %min
ret i64 %add5
}
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #5
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @factorial(i64 noundef %n) local_unnamed_addr #6 {
entry:
%cmp.not4 = icmp slt i64 %n, 1
br i1 %cmp.not4, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %n, 3
%0 = icmp ult i64 %n, 4
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 %n, -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 ]
%i.06.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.3, %for.body ]
%ret.05.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
%i.06.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.06.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%ret.05.epil = phi i64 [ %rem.epil, %for.body.epil ], [ %ret.05.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = mul i64 %i.06.epil, %ret.05.epil
%rem.epil = urem i64 %mul.epil, 1000000007
%inc.epil = add nuw i64 %i.06.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 !18
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%ret.0.lcssa = phi i64 [ 1, %entry ], [ %rem.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %rem.epil, %for.body.epil ]
ret i64 %ret.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%i.06 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.3, %for.body ]
%ret.05 = phi i64 [ 1, %for.body.preheader.new ], [ %rem.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%mul = mul i64 %i.06, %ret.05
%rem = urem i64 %mul, 1000000007
%inc = add nuw nsw i64 %i.06, 1
%mul.1 = mul i64 %inc, %rem
%rem.1 = urem i64 %mul.1, 1000000007
%inc.1 = add nuw nsw i64 %i.06, 2
%mul.2 = mul i64 %inc.1, %rem.1
%rem.2 = urem i64 %mul.2, 1000000007
%inc.2 = add nuw i64 %i.06, 3
%mul.3 = mul i64 %inc.2, %rem.2
%rem.3 = urem i64 %mul.3, 1000000007
%inc.3 = add nuw i64 %i.06, 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 !20
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @qsort_09(ptr nocapture noundef readonly %sys1, ptr nocapture noundef readonly %sys2) local_unnamed_addr #7 {
entry:
%0 = load i32, ptr %sys1, align 4, !tbaa !21
%1 = load i32, ptr %sys2, align 4, !tbaa !21
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %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 @qsort_90(ptr nocapture noundef readonly %sys1, ptr nocapture noundef readonly %sys2) local_unnamed_addr #7 {
entry:
%0 = load i32, ptr %sys1, align 4, !tbaa !21
%1 = load i32, ptr %sys2, align 4, !tbaa !21
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @fibonacci(i64 noundef %n) local_unnamed_addr #8 {
entry:
%switch13 = icmp ult i64 %n, 2
br i1 %switch13, label %return, label %sw.default
sw.default: ; preds = %entry, %sw.default
%n.tr15 = phi i64 [ %sub2, %sw.default ], [ %n, %entry ]
%accumulator.tr14 = phi i64 [ %add, %sw.default ], [ 0, %entry ]
%sub = add nsw i64 %n.tr15, -1
%call = tail call i64 @fibonacci(i64 noundef %sub)
%sub2 = add nsw i64 %n.tr15, -2
%add = add nsw i64 %call, %accumulator.tr14
%switch = icmp ult i64 %sub2, 2
br i1 %switch, label %return, label %sw.default
return: ; preds = %sw.default, %entry
%accumulator.tr.lcssa = phi i64 [ 0, %entry ], [ %add, %sw.default ]
%n.tr.lcssa = phi i64 [ %n, %entry ], [ %sub2, %sw.default ]
%accumulator.ret.tr = add nsw i64 %n.tr.lcssa, %accumulator.tr.lcssa
ret i64 %accumulator.ret.tr
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @sel_max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #9 {
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 @sel_min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #9 {
entry:
%b.a = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %b.a
}
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i64 @can_DP(i64 noundef %how_data, ptr nocapture noundef readonly %data, i64 noundef %how_can, ptr nocapture noundef %can) local_unnamed_addr #10 {
entry:
%cmp59 = icmp sgt i64 %how_can, 0
br i1 %cmp59, label %for.end, label %for.end.thread
for.end: ; preds = %entry
tail call void @llvm.memset.p0.i64(ptr align 1 %can, i8 0, i64 %how_can, i1 false), !tbaa !23
store i8 1, ptr %can, align 1, !tbaa !23
%cmp364 = icmp sgt i64 %how_data, 0
br i1 %cmp364, label %for.cond5.preheader.us.preheader, label %for.cond22.preheader
for.cond5.preheader.us.preheader: ; preds = %for.end
%xtraiter = and i64 %how_can, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%loopB.063.us.prol = add nsw i64 %how_can, -1
%arrayidx8.us.prol = getelementptr inbounds i8, ptr %can, i64 %loopB.063.us.prol
%0 = icmp eq i64 %how_can, 1
br label %for.cond5.preheader.us
for.end.thread: ; preds = %entry
store i8 1, ptr %can, align 1, !tbaa !23
br label %for.end36
for.cond5.preheader.us: ; preds = %for.cond5.preheader.us.preheader, %for.cond5.for.inc19_crit_edge.us
%loopA.165.us = phi i64 [ %inc20.us, %for.cond5.for.inc19_crit_edge.us ], [ 0, %for.cond5.preheader.us.preheader ]
%arrayidx11.us = getelementptr inbounds i64, ptr %data, i64 %loopA.165.us
br i1 %lcmp.mod.not, label %for.body7.us.prol.loopexit, label %for.body7.us.prol
for.body7.us.prol: ; preds = %for.cond5.preheader.us
%1 = load i8, ptr %arrayidx8.us.prol, align 1, !tbaa !23, !range !25, !noundef !26
%tobool.not.us.prol = icmp eq i8 %1, 0
br i1 %tobool.not.us.prol, label %for.body7.us.prol.loopexit, label %land.lhs.true.us.prol
land.lhs.true.us.prol: ; preds = %for.body7.us.prol
%2 = load i64, ptr %arrayidx11.us, align 8, !tbaa !5
%add.us.prol = add nsw i64 %2, %loopB.063.us.prol
%cmp12.us.prol = icmp slt i64 %add.us.prol, %how_can
br i1 %cmp12.us.prol, label %if.then.us.prol, label %for.body7.us.prol.loopexit
if.then.us.prol: ; preds = %land.lhs.true.us.prol
%arrayidx16.us.prol = getelementptr inbounds i8, ptr %can, i64 %add.us.prol
store i8 1, ptr %arrayidx16.us.prol, align 1, !tbaa !23
br label %for.body7.us.prol.loopexit
for.body7.us.prol.loopexit: ; preds = %for.body7.us.prol, %land.lhs.true.us.prol, %if.then.us.prol, %for.cond5.preheader.us
%loopB.063.us.in.unr = phi i64 [ %how_can, %for.cond5.preheader.us ], [ %loopB.063.us.prol, %if.then.us.prol ], [ %loopB.063.us.prol, %land.lhs.true.us.prol ], [ %loopB.063.us.prol, %for.body7.us.prol ]
br i1 %0, label %for.cond5.for.inc19_crit_edge.us, label %for.body7.us
for.body7.us: ; preds = %for.body7.us.prol.loopexit, %for.inc17.us.1
%loopB.063.us.in = phi i64 [ %loopB.063.us.1, %for.inc17.us.1 ], [ %loopB.063.us.in.unr, %for.body7.us.prol.loopexit ]
%loopB.063.us = add nsw i64 %loopB.063.us.in, -1
%arrayidx8.us = getelementptr inbounds i8, ptr %can, i64 %loopB.063.us
%3 = load i8, ptr %arrayidx8.us, align 1, !tbaa !23, !range !25, !noundef !26
%tobool.not.us = icmp eq i8 %3, 0
br i1 %tobool.not.us, label %for.inc17.us, label %land.lhs.true.us
land.lhs.true.us: ; preds = %for.body7.us
%4 = load i64, ptr %arrayidx11.us, align 8, !tbaa !5
%add.us = add nsw i64 %4, %loopB.063.us
%cmp12.us = icmp slt i64 %add.us, %how_can
br i1 %cmp12.us, label %if.then.us, label %for.inc17.us
if.then.us: ; preds = %land.lhs.true.us
%arrayidx16.us = getelementptr inbounds i8, ptr %can, i64 %add.us
store i8 1, ptr %arrayidx16.us, align 1, !tbaa !23
br label %for.inc17.us
for.inc17.us: ; preds = %if.then.us, %land.lhs.true.us, %for.body7.us
%loopB.063.us.1 = add nsw i64 %loopB.063.us.in, -2
%arrayidx8.us.1 = getelementptr inbounds i8, ptr %can, i64 %loopB.063.us.1
%5 = load i8, ptr %arrayidx8.us.1, align 1, !tbaa !23, !range !25, !noundef !26
%tobool.not.us.1 = icmp eq i8 %5, 0
br i1 %tobool.not.us.1, label %for.inc17.us.1, label %land.lhs.true.us.1
land.lhs.true.us.1: ; preds = %for.inc17.us
%6 = load i64, ptr %arrayidx11.us, align 8, !tbaa !5
%add.us.1 = add nsw i64 %6, %loopB.063.us.1
%cmp12.us.1 = icmp slt i64 %add.us.1, %how_can
br i1 %cmp12.us.1, label %if.then.us.1, label %for.inc17.us.1
if.then.us.1: ; preds = %land.lhs.true.us.1
%arrayidx16.us.1 = getelementptr inbounds i8, ptr %can, i64 %add.us.1
store i8 1, ptr %arrayidx16.us.1, align 1, !tbaa !23
br label %for.inc17.us.1
for.inc17.us.1: ; preds = %if.then.us.1, %land.lhs.true.us.1, %for.inc17.us
%cmp6.us.1 = icmp sgt i64 %loopB.063.us.in, 2
br i1 %cmp6.us.1, label %for.body7.us, label %for.cond5.for.inc19_crit_edge.us, !llvm.loop !27
for.cond5.for.inc19_crit_edge.us: ; preds = %for.inc17.us.1, %for.body7.us.prol.loopexit
%inc20.us = add nuw nsw i64 %loopA.165.us, 1
%exitcond.not = icmp eq i64 %inc20.us, %how_data
br i1 %exitcond.not, label %for.cond22.preheader, label %for.cond5.preheader.us, !llvm.loop !28
for.cond22.preheader: ; preds = %for.cond5.for.inc19_crit_edge.us, %for.end
br i1 %cmp59, label %for.body25.preheader, label %for.end36
for.body25.preheader: ; preds = %for.cond22.preheader
%xtraiter72 = and i64 %how_can, 7
%7 = icmp ult i64 %how_can, 8
br i1 %7, label %for.end36.loopexit.unr-lcssa, label %for.body25.preheader.new
for.body25.preheader.new: ; preds = %for.body25.preheader
%unroll_iter = and i64 %how_can, -8
br label %for.body25
for.body25: ; preds = %for.body25, %for.body25.preheader.new
%ret.068 = phi i64 [ 0, %for.body25.preheader.new ], [ %spec.select.7, %for.body25 ]
%loopA.267 = phi i64 [ 0, %for.body25.preheader.new ], [ %inc35.7, %for.body25 ]
%niter = phi i64 [ 0, %for.body25.preheader.new ], [ %niter.next.7, %for.body25 ]
%arrayidx26 = getelementptr inbounds i8, ptr %can, i64 %loopA.267
%8 = load i8, ptr %arrayidx26, align 1, !tbaa !23, !range !25, !noundef !26
%inc32 = zext i8 %8 to i64
%spec.select = add nuw nsw i64 %ret.068, %inc32
%inc35 = or i64 %loopA.267, 1
%arrayidx26.1 = getelementptr inbounds i8, ptr %can, i64 %inc35
%9 = load i8, ptr %arrayidx26.1, align 1, !tbaa !23, !range !25, !noundef !26
%inc32.1 = zext i8 %9 to i64
%spec.select.1 = add nuw nsw i64 %spec.select, %inc32.1
%inc35.1 = or i64 %loopA.267, 2
%arrayidx26.2 = getelementptr inbounds i8, ptr %can, i64 %inc35.1
%10 = load i8, ptr %arrayidx26.2, align 1, !tbaa !23, !range !25, !noundef !26
%inc32.2 = zext i8 %10 to i64
%spec.select.2 = add nuw nsw i64 %spec.select.1, %inc32.2
%inc35.2 = or i64 %loopA.267, 3
%arrayidx26.3 = getelementptr inbounds i8, ptr %can, i64 %inc35.2
%11 = load i8, ptr %arrayidx26.3, align 1, !tbaa !23, !range !25, !noundef !26
%inc32.3 = zext i8 %11 to i64
%spec.select.3 = add nuw nsw i64 %spec.select.2, %inc32.3
%inc35.3 = or i64 %loopA.267, 4
%arrayidx26.4 = getelementptr inbounds i8, ptr %can, i64 %inc35.3
%12 = load i8, ptr %arrayidx26.4, align 1, !tbaa !23, !range !25, !noundef !26
%inc32.4 = zext i8 %12 to i64
%spec.select.4 = add nuw nsw i64 %spec.select.3, %inc32.4
%inc35.4 = or i64 %loopA.267, 5
%arrayidx26.5 = getelementptr inbounds i8, ptr %can, i64 %inc35.4
%13 = load i8, ptr %arrayidx26.5, align 1, !tbaa !23, !range !25, !noundef !26
%inc32.5 = zext i8 %13 to i64
%spec.select.5 = add nuw nsw i64 %spec.select.4, %inc32.5
%inc35.5 = or i64 %loopA.267, 6
%arrayidx26.6 = getelementptr inbounds i8, ptr %can, i64 %inc35.5
%14 = load i8, ptr %arrayidx26.6, align 1, !tbaa !23, !range !25, !noundef !26
%inc32.6 = zext i8 %14 to i64
%spec.select.6 = add nuw nsw i64 %spec.select.5, %inc32.6
%inc35.6 = or i64 %loopA.267, 7
%arrayidx26.7 = getelementptr inbounds i8, ptr %can, i64 %inc35.6
%15 = load i8, ptr %arrayidx26.7, align 1, !tbaa !23, !range !25, !noundef !26
%inc32.7 = zext i8 %15 to i64
%spec.select.7 = add nuw nsw i64 %spec.select.6, %inc32.7
%inc35.7 = add nuw nsw i64 %loopA.267, 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.end36.loopexit.unr-lcssa, label %for.body25, !llvm.loop !29
for.end36.loopexit.unr-lcssa: ; preds = %for.body25, %for.body25.preheader
%spec.select.lcssa.ph = phi i64 [ undef, %for.body25.preheader ], [ %spec.select.7, %for.body25 ]
%ret.068.unr = phi i64 [ 0, %for.body25.preheader ], [ %spec.select.7, %for.body25 ]
%loopA.267.unr = phi i64 [ 0, %for.body25.preheader ], [ %inc35.7, %for.body25 ]
%lcmp.mod73.not = icmp eq i64 %xtraiter72, 0
br i1 %lcmp.mod73.not, label %for.end36, label %for.body25.epil
for.body25.epil: ; preds = %for.end36.loopexit.unr-lcssa, %for.body25.epil
%ret.068.epil = phi i64 [ %spec.select.epil, %for.body25.epil ], [ %ret.068.unr, %for.end36.loopexit.unr-lcssa ]
%loopA.267.epil = phi i64 [ %inc35.epil, %for.body25.epil ], [ %loopA.267.unr, %for.end36.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body25.epil ], [ 0, %for.end36.loopexit.unr-lcssa ]
%arrayidx26.epil = getelementptr inbounds i8, ptr %can, i64 %loopA.267.epil
%16 = load i8, ptr %arrayidx26.epil, align 1, !tbaa !23, !range !25, !noundef !26
%inc32.epil = zext i8 %16 to i64
%spec.select.epil = add nuw nsw i64 %ret.068.epil, %inc32.epil
%inc35.epil = add nuw nsw i64 %loopA.267.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter72
br i1 %epil.iter.cmp.not, label %for.end36, label %for.body25.epil, !llvm.loop !30
for.end36: ; preds = %for.end36.loopexit.unr-lcssa, %for.body25.epil, %for.end.thread, %for.cond22.preheader
%ret.0.lcssa = phi i64 [ 0, %for.cond22.preheader ], [ 0, %for.end.thread ], [ %spec.select.lcssa.ph, %for.end36.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body25.epil ]
ret i64 %ret.0.lcssa
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @array_max(i64 noundef %how_data, ptr nocapture noundef readonly %data) local_unnamed_addr #11 {
entry:
%0 = load i64, ptr %data, align 8, !tbaa !5
%cmp10 = icmp sgt i64 %how_data, 0
br i1 %cmp10, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %how_data, 4
br i1 %min.iters.check, label %for.body.preheader15, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %how_data, -4
%minmax.ident.splatinsert = insertelement <2 x i64> poison, i64 %0, i64 0
%minmax.ident.splat = shufflevector <2 x i64> %minmax.ident.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %minmax.ident.splat, %vector.ph ], [ %3, %vector.body ]
%vec.phi13 = phi <2 x i64> [ %minmax.ident.splat, %vector.ph ], [ %4, %vector.body ]
%1 = getelementptr inbounds i64, ptr %data, i64 %index
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = getelementptr inbounds i64, ptr %1, i64 2
%wide.load14 = load <2 x i64>, ptr %2, align 8, !tbaa !5
%3 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%4 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi13, <2 x i64> %wide.load14)
%index.next = add nuw i64 %index, 4
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !31
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %3, <2 x i64> %4)
%6 = tail call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %how_data
br i1 %cmp.n, label %for.end, label %for.body.preheader15
for.body.preheader15: ; preds = %for.body.preheader, %middle.block
%ret.012.ph = phi i64 [ %0, %for.body.preheader ], [ %6, %middle.block ]
%loop.011.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader15, %for.body
%ret.012 = phi i64 [ %spec.select, %for.body ], [ %ret.012.ph, %for.body.preheader15 ]
%loop.011 = phi i64 [ %inc, %for.body ], [ %loop.011.ph, %for.body.preheader15 ]
%arrayidx1 = getelementptr inbounds i64, ptr %data, i64 %loop.011
%7 = load i64, ptr %arrayidx1, align 8, !tbaa !5
%spec.select = tail call i64 @llvm.smax.i64(i64 %ret.012, i64 %7)
%inc = add nuw nsw i64 %loop.011, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !32
for.end: ; preds = %for.body, %middle.block, %entry
%ret.0.lcssa = phi i64 [ %0, %entry ], [ %6, %middle.block ], [ %spec.select, %for.body ]
ret i64 %ret.0.lcssa
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @array_min(i64 noundef %how_data, ptr nocapture noundef readonly %data) local_unnamed_addr #11 {
entry:
%0 = load i64, ptr %data, align 8, !tbaa !5
%cmp10 = icmp sgt i64 %how_data, 0
br i1 %cmp10, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %how_data, 4
br i1 %min.iters.check, label %for.body.preheader15, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %how_data, -4
%minmax.ident.splatinsert = insertelement <2 x i64> poison, i64 %0, i64 0
%minmax.ident.splat = shufflevector <2 x i64> %minmax.ident.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %minmax.ident.splat, %vector.ph ], [ %3, %vector.body ]
%vec.phi13 = phi <2 x i64> [ %minmax.ident.splat, %vector.ph ], [ %4, %vector.body ]
%1 = getelementptr inbounds i64, ptr %data, i64 %index
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = getelementptr inbounds i64, ptr %1, i64 2
%wide.load14 = load <2 x i64>, ptr %2, align 8, !tbaa !5
%3 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%4 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi13, <2 x i64> %wide.load14)
%index.next = add nuw i64 %index, 4
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !33
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %3, <2 x i64> %4)
%6 = tail call i64 @llvm.vector.reduce.smin.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %how_data
br i1 %cmp.n, label %for.end, label %for.body.preheader15
for.body.preheader15: ; preds = %for.body.preheader, %middle.block
%ret.012.ph = phi i64 [ %0, %for.body.preheader ], [ %6, %middle.block ]
%loop.011.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader15, %for.body
%ret.012 = phi i64 [ %spec.select, %for.body ], [ %ret.012.ph, %for.body.preheader15 ]
%loop.011 = phi i64 [ %inc, %for.body ], [ %loop.011.ph, %for.body.preheader15 ]
%arrayidx1 = getelementptr inbounds i64, ptr %data, i64 %loop.011
%7 = load i64, ptr %arrayidx1, align 8, !tbaa !5
%spec.select = tail call i64 @llvm.smin.i64(i64 %ret.012, i64 %7)
%inc = add nuw nsw i64 %loop.011, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !34
for.end: ; preds = %for.body, %middle.block, %entry
%ret.0.lcssa = phi i64 [ %0, %entry ], [ %6, %middle.block ], [ %spec.select, %for.body ]
ret i64 %ret.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @array_sum(i64 noundef %how_data, ptr nocapture noundef readonly %data) local_unnamed_addr #12 {
entry:
%cmp4 = icmp sgt i64 %how_data, 0
br i1 %cmp4, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %how_data, 4
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %how_data, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %2, %vector.body ]
%vec.phi7 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %data, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load8 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = add <2 x i64> %wide.load, %vec.phi
%3 = add <2 x i64> %wide.load8, %vec.phi7
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !35
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %3, %2
%5 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %how_data
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%loop.06.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%ret.05.ph = phi i64 [ 0, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%loop.06 = phi i64 [ %inc, %for.body ], [ %loop.06.ph, %for.body.preheader9 ]
%ret.05 = phi i64 [ %add, %for.body ], [ %ret.05.ph, %for.body.preheader9 ]
%arrayidx = getelementptr inbounds i64, ptr %data, i64 %loop.06
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%add = add nsw i64 %6, %ret.05
%inc = add nuw nsw i64 %loop.06, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !36
for.end: ; preds = %for.body, %middle.block, %entry
%ret.0.lcssa = phi i64 [ 0, %entry ], [ %5, %middle.block ], [ %add, %for.body ]
ret i64 %ret.0.lcssa
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @Leven_dist(ptr nocapture noundef readonly %now, ptr nocapture noundef readonly %target) local_unnamed_addr #13 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %now) #22
%add = add i64 %call, 1
%call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %target) #22
%add2 = add i64 %call1, 1
%0 = mul nuw i64 %add2, %add
%vla = alloca i64, i64 %0, align 16
%cmp81 = icmp ult i64 %call, 9223372036854775807
br i1 %cmp81, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %add, 3
%1 = icmp ult i64 %call, 3
br i1 %1, label %for.cond4.preheader.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %add, -4
br label %for.body
for.cond4.preheader.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%loopA.082.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond4.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond4.preheader.loopexit.unr-lcssa, %for.body.epil
%loopA.082.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %loopA.082.unr, %for.cond4.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond4.preheader.loopexit.unr-lcssa ]
%2 = mul nsw i64 %loopA.082.epil, %add2
%arrayidx.epil = getelementptr inbounds i64, ptr %vla, i64 %2
store i64 %loopA.082.epil, ptr %arrayidx.epil, align 8, !tbaa !5
%inc.epil = add nuw nsw i64 %loopA.082.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.cond4.preheader, label %for.body.epil, !llvm.loop !37
for.cond4.preheader: ; preds = %for.cond4.preheader.loopexit.unr-lcssa, %for.body.epil, %entry
%cmp583 = icmp ult i64 %call1, 9223372036854775807
br i1 %cmp583, label %for.body6.preheader, label %for.cond12.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%min.iters.check = icmp ult i64 %add2, 4
br i1 %min.iters.check, label %for.body6.preheader95, label %vector.ph
vector.ph: ; preds = %for.body6.preheader
%n.vec = and i64 %add2, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i64> [ <i64 0, i64 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i64> %vec.ind, <i64 2, i64 2>
%3 = getelementptr inbounds i64, ptr %vla, i64 %index
store <2 x i64> %vec.ind, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i64, ptr %3, i64 2
store <2 x i64> %step.add, ptr %4, align 16, !tbaa !5
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !38
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %add2, %n.vec
br i1 %cmp.n, label %for.cond12.preheader, label %for.body6.preheader95
for.body6.preheader95: ; preds = %for.body6.preheader, %middle.block
%loopA.184.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ]
br label %for.body6
for.body: ; preds = %for.body, %for.body.preheader.new
%loopA.082 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%6 = mul nsw i64 %loopA.082, %add2
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %6
store i64 %loopA.082, ptr %arrayidx, align 16, !tbaa !5
%inc = or i64 %loopA.082, 1
%7 = mul nsw i64 %inc, %add2
%arrayidx.1 = getelementptr inbounds i64, ptr %vla, i64 %7
store i64 %inc, ptr %arrayidx.1, align 8, !tbaa !5
%inc.1 = or i64 %loopA.082, 2
%8 = mul nsw i64 %inc.1, %add2
%arrayidx.2 = getelementptr inbounds i64, ptr %vla, i64 %8
store i64 %inc.1, ptr %arrayidx.2, align 16, !tbaa !5
%inc.2 = or i64 %loopA.082, 3
%9 = mul nsw i64 %inc.2, %add2
%arrayidx.3 = getelementptr inbounds i64, ptr %vla, i64 %9
store i64 %inc.2, ptr %arrayidx.3, align 8, !tbaa !5
%inc.3 = add nuw nsw i64 %loopA.082, 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.cond4.preheader.loopexit.unr-lcssa, label %for.body, !llvm.loop !39
for.cond12.preheader: ; preds = %for.body6, %middle.block, %for.cond4.preheader
%cmp1387 = icmp sgt i64 %add, 1
%cmp1685 = icmp sgt i64 %add2, 1
%or.cond = select i1 %cmp1387, i1 %cmp1685, i1 false
br i1 %or.cond, label %for.cond15.preheader.us, label %for.end47
for.cond15.preheader.us: ; preds = %for.cond12.preheader, %for.cond15.for.inc45_crit_edge.us
%loopA.288.us = phi i64 [ %inc46.us, %for.cond15.for.inc45_crit_edge.us ], [ 1, %for.cond12.preheader ]
%sub.us = add nsw i64 %loopA.288.us, -1
%arrayidx18.us = getelementptr inbounds i8, ptr %now, i64 %sub.us
%10 = load i8, ptr %arrayidx18.us, align 1, !tbaa !40
%11 = mul nsw i64 %sub.us, %add2
%arrayidx26.us = getelementptr inbounds i64, ptr %vla, i64 %11
%12 = mul nsw i64 %loopA.288.us, %add2
%arrayidx29.us = getelementptr inbounds i64, ptr %vla, i64 %12
%.pre = load i64, ptr %arrayidx29.us, align 8, !tbaa !5
br label %for.body17.us
for.body17.us: ; preds = %for.cond15.preheader.us, %for.body17.us
%13 = phi i64 [ %.pre, %for.cond15.preheader.us ], [ %b.a.i80.us, %for.body17.us ]
%loopB.086.us = phi i64 [ 1, %for.cond15.preheader.us ], [ %inc43.us, %for.body17.us ]
%sub19.us = add nsw i64 %loopB.086.us, -1
%arrayidx20.us = getelementptr inbounds i8, ptr %target, i64 %sub19.us
%14 = load i8, ptr %arrayidx20.us, align 1, !tbaa !40
%cmp22.us = icmp ne i8 %10, %14
%conv24.us = zext i1 %cmp22.us to i64
%arrayidx27.us = getelementptr inbounds i64, ptr %arrayidx26.us, i64 %loopB.086.us
%15 = load i64, ptr %arrayidx27.us, align 8, !tbaa !5
%add28.us = add nsw i64 %15, 1
%add32.us = add nsw i64 %13, 1
%b.a.i.us = tail call i64 @llvm.smin.i64(i64 %add28.us, i64 %add32.us)
%arrayidx37.us = getelementptr inbounds i64, ptr %arrayidx26.us, i64 %sub19.us
%16 = load i64, ptr %arrayidx37.us, align 8, !tbaa !5
%add38.us = add nsw i64 %16, %conv24.us
%b.a.i80.us = tail call i64 @llvm.smin.i64(i64 %b.a.i.us, i64 %add38.us)
%arrayidx41.us = getelementptr inbounds i64, ptr %arrayidx29.us, i64 %loopB.086.us
store i64 %b.a.i80.us, ptr %arrayidx41.us, align 8, !tbaa !5
%inc43.us = add nuw nsw i64 %loopB.086.us, 1
%exitcond92.not = icmp eq i64 %loopB.086.us, %call1
br i1 %exitcond92.not, label %for.cond15.for.inc45_crit_edge.us, label %for.body17.us, !llvm.loop !41
for.cond15.for.inc45_crit_edge.us: ; preds = %for.body17.us
%inc46.us = add nuw nsw i64 %loopA.288.us, 1
%exitcond93.not = icmp eq i64 %loopA.288.us, %call
br i1 %exitcond93.not, label %for.end47, label %for.cond15.preheader.us, !llvm.loop !42
for.body6: ; preds = %for.body6.preheader95, %for.body6
%loopA.184 = phi i64 [ %inc10, %for.body6 ], [ %loopA.184.ph, %for.body6.preheader95 ]
%arrayidx8 = getelementptr inbounds i64, ptr %vla, i64 %loopA.184
store i64 %loopA.184, ptr %arrayidx8, align 8, !tbaa !5
%inc10 = add nuw nsw i64 %loopA.184, 1
%exitcond91.not = icmp eq i64 %loopA.184, %call1
br i1 %exitcond91.not, label %for.cond12.preheader, label %for.body6, !llvm.loop !43
for.end47: ; preds = %for.cond15.for.inc45_crit_edge.us, %for.cond12.preheader
%17 = mul nsw i64 %add2, %call
%arrayidx49 = getelementptr inbounds i64, ptr %vla, i64 %17
%arrayidx51 = getelementptr inbounds i64, ptr %arrayidx49, i64 %call1
%18 = load i64, ptr %arrayidx51, align 8, !tbaa !5
ret i64 %18
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #14
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local void @prime_fact(i64 noundef %target, ptr nocapture noundef writeonly %data) local_unnamed_addr #15 {
entry:
%cmp.not28 = icmp eq i64 %target, 1
br i1 %cmp.not28, label %while.end12, label %while.cond1.preheader.lr.ph
while.cond1.preheader.lr.ph: ; preds = %entry
%conv3 = sitofp i64 %target to double
br label %while.cond1.preheader
while.cond1.preheader: ; preds = %while.cond1.preheader.lr.ph, %while.end
%target.addr.031 = phi i64 [ %target, %while.cond1.preheader.lr.ph ], [ %div, %while.end ]
%loopA.030 = phi i64 [ 1, %while.cond1.preheader.lr.ph ], [ %loopA.1, %while.end ]
%loopB.029 = phi i64 [ 0, %while.cond1.preheader.lr.ph ], [ %inc10, %while.end ]
br label %while.cond1
while.cond1: ; preds = %while.cond1.preheader, %if.end
%loopA.1 = phi i64 [ %inc, %if.end ], [ %loopA.030, %while.cond1.preheader ]
%inc = add nsw i64 %loopA.1, 1
%conv = sitofp i64 %inc to double
%call = tail call double @sqrt(double noundef %conv3) #21
%add = fadd double %call, 1.000000e+02
%cmp4 = fcmp ugt double %add, %conv
br i1 %cmp4, label %if.end, label %while.end.thread
while.end.thread: ; preds = %while.cond1
%arrayidx = getelementptr inbounds i64, ptr %data, i64 %loopB.029
store i64 %target.addr.031, ptr %arrayidx, align 8, !tbaa !5
br label %while.end12
if.end: ; preds = %while.cond1
%rem = srem i64 %target.addr.031, %inc
%div = sdiv i64 %target.addr.031, %inc
%cmp6 = icmp eq i64 %rem, 0
br i1 %cmp6, label %while.end, label %while.cond1
while.end: ; preds = %if.end
%arrayidx9 = getelementptr inbounds i64, ptr %data, i64 %loopB.029
store i64 %inc, ptr %arrayidx9, align 8, !tbaa !5
%inc10 = add nuw nsw i64 %loopB.029, 1
%cmp.not = icmp eq i64 %div, 1
br i1 %cmp.not, label %while.end12, label %while.cond1.preheader, !llvm.loop !44
while.end12: ; preds = %while.end, %while.end.thread, %entry
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #16
; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local i64 @get_digit(i64 noundef %target) local_unnamed_addr #17 {
entry:
%conv = sitofp i64 %target to double
%call = tail call double @log10(double noundef %conv) #21
%add = fadd double %call, 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 #16
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @ncr(i64 noundef %n, i64 noundef %r) local_unnamed_addr #8 {
entry:
%pascal = alloca [100 x [102 x i64]], align 16
call void @llvm.lifetime.start.p0(i64 81600, ptr nonnull %pascal) #21
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(81600) %pascal, i8 0, i64 81600, i1 false)
%arrayidx = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 1
store i64 1, ptr %arrayidx, align 16, !tbaa !5
%arrayidx3 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 1, i64 1
store i64 1, ptr %arrayidx3, align 8, !tbaa !5
br label %for.body
for.body: ; preds = %entry, %for.end
%indvar = phi i64 [ 0, %entry ], [ %indvar.next, %for.end ]
%loopA.037 = phi i64 [ 2, %entry ], [ %inc20, %for.end ]
%0 = add i64 %indvar, 1
%arrayidx4 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %loopA.037
store i64 1, ptr %arrayidx4, align 16, !tbaa !5
%sub = add nsw i64 %loopA.037, -1
%arrayidx11.phi.trans.insert = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %sub, i64 0
%.pre = load i64, ptr %arrayidx11.phi.trans.insert, align 16, !tbaa !5
%min.iters.check = icmp ult i64 %0, 2
br i1 %min.iters.check, label %for.body8.preheader, label %vector.ph
vector.ph: ; preds = %for.body
%n.vec = and i64 %0, -2
%ind.end = or i64 %0, 1
%vector.recur.init = insertelement <2 x i64> poison, i64 %.pre, i64 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <2 x i64> [ %vector.recur.init, %vector.ph ], [ %wide.load, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %sub, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = shufflevector <2 x i64> %vector.recur, <2 x i64> %wide.load, <2 x i32> <i32 1, i32 2>
%3 = add nsw <2 x i64> %wide.load, %2
%4 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %loopA.037, i64 %offset.idx
store <2 x i64> %3, ptr %4, align 8, !tbaa !5
%index.next = add nuw i64 %index, 2
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !45
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %0, %n.vec
%vector.recur.extract = extractelement <2 x i64> %wide.load, i64 1
br i1 %cmp.n, label %for.end, label %for.body8.preheader
for.body8.preheader: ; preds = %for.body, %middle.block
%scalar.recur.ph = phi i64 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body ]
%loopB.036.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body ]
br label %for.body8
for.body8: ; preds = %for.body8.preheader, %for.body8
%scalar.recur = phi i64 [ %6, %for.body8 ], [ %scalar.recur.ph, %for.body8.preheader ]
%loopB.036 = phi i64 [ %inc, %for.body8 ], [ %loopB.036.ph, %for.body8.preheader ]
%arrayidx14 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %sub, i64 %loopB.036
%6 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%add = add nsw i64 %6, %scalar.recur
%arrayidx16 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %loopA.037, i64 %loopB.036
store i64 %add, ptr %arrayidx16, align 8, !tbaa !5
%inc = add nuw nsw i64 %loopB.036, 1
%exitcond.not = icmp eq i64 %inc, %loopA.037
br i1 %exitcond.not, label %for.end, label %for.body8, !llvm.loop !46
for.end: ; preds = %for.body8, %middle.block
%arrayidx18 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %loopA.037, i64 %loopA.037
store i64 1, ptr %arrayidx18, align 8, !tbaa !5
%inc20 = add nuw nsw i64 %loopA.037, 1
%exitcond38.not = icmp eq i64 %inc20, 100
%indvar.next = add i64 %indvar, 1
br i1 %exitcond38.not, label %for.end21, label %for.body, !llvm.loop !47
for.end21: ; preds = %for.end
%arrayidx23 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %n, i64 %r
%7 = load i64, ptr %arrayidx23, align 8, !tbaa !5
call void @llvm.lifetime.end.p0(i64 81600, ptr nonnull %pascal) #21
ret i64 %7
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #18
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @npr(i64 noundef %n, i64 noundef %r) local_unnamed_addr #8 {
entry:
%pascal.i = alloca [100 x [102 x i64]], align 16
call void @llvm.lifetime.start.p0(i64 81600, ptr nonnull %pascal.i) #21
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(81600) %pascal.i, i8 0, i64 81600, i1 false)
%arrayidx.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 1
store i64 1, ptr %arrayidx.i, align 16, !tbaa !5
%arrayidx3.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 1, i64 1
store i64 1, ptr %arrayidx3.i, align 8, !tbaa !5
br label %for.body.i
for.body.i: ; preds = %for.end.i, %entry
%indvar = phi i64 [ %indvar.next, %for.end.i ], [ 0, %entry ]
%loopA.037.i = phi i64 [ %inc20.i, %for.end.i ], [ 2, %entry ]
%0 = add i64 %indvar, 1
%arrayidx4.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i
store i64 1, ptr %arrayidx4.i, align 16, !tbaa !5
%sub.i = add nsw i64 %loopA.037.i, -1
%arrayidx11.phi.trans.insert.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub.i, i64 0
%.pre.i = load i64, ptr %arrayidx11.phi.trans.insert.i, align 16, !tbaa !5
%min.iters.check = icmp ult i64 %0, 2
br i1 %min.iters.check, label %for.body8.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.i
%n.vec = and i64 %0, -2
%ind.end = or i64 %0, 1
%vector.recur.init = insertelement <2 x i64> poison, i64 %.pre.i, i64 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <2 x i64> [ %vector.recur.init, %vector.ph ], [ %wide.load, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub.i, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = shufflevector <2 x i64> %vector.recur, <2 x i64> %wide.load, <2 x i32> <i32 1, i32 2>
%3 = add nsw <2 x i64> %wide.load, %2
%4 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i, i64 %offset.idx
store <2 x i64> %3, ptr %4, align 8, !tbaa !5
%index.next = add nuw i64 %index, 2
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !48
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %0, %n.vec
%vector.recur.extract = extractelement <2 x i64> %wide.load, i64 1
br i1 %cmp.n, label %for.end.i, label %for.body8.i.preheader
for.body8.i.preheader: ; preds = %for.body.i, %middle.block
%scalar.recur.ph = phi i64 [ %vector.recur.extract, %middle.block ], [ %.pre.i, %for.body.i ]
%loopB.036.i.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body.i ]
br label %for.body8.i
for.body8.i: ; preds = %for.body8.i.preheader, %for.body8.i
%scalar.recur = phi i64 [ %6, %for.body8.i ], [ %scalar.recur.ph, %for.body8.i.preheader ]
%loopB.036.i = phi i64 [ %inc.i, %for.body8.i ], [ %loopB.036.i.ph, %for.body8.i.preheader ]
%arrayidx14.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub.i, i64 %loopB.036.i
%6 = load i64, ptr %arrayidx14.i, align 8, !tbaa !5
%add.i = add nsw i64 %6, %scalar.recur
%arrayidx16.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i, i64 %loopB.036.i
store i64 %add.i, ptr %arrayidx16.i, align 8, !tbaa !5
%inc.i = add nuw nsw i64 %loopB.036.i, 1
%exitcond.not.i = icmp eq i64 %inc.i, %loopA.037.i
br i1 %exitcond.not.i, label %for.end.i, label %for.body8.i, !llvm.loop !49
for.end.i: ; preds = %for.body8.i, %middle.block
%arrayidx18.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i, i64 %loopA.037.i
store i64 1, ptr %arrayidx18.i, align 8, !tbaa !5
%inc20.i = add nuw nsw i64 %loopA.037.i, 1
%exitcond38.not.i = icmp eq i64 %inc20.i, 100
%indvar.next = add i64 %indvar, 1
br i1 %exitcond38.not.i, label %ncr.exit, label %for.body.i, !llvm.loop !47
ncr.exit: ; preds = %for.end.i
%arrayidx23.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %n, i64 %r
%7 = load i64, ptr %arrayidx23.i, align 8, !tbaa !5
call void @llvm.lifetime.end.p0(i64 81600, ptr nonnull %pascal.i) #21
%cmp.not4.i = icmp slt i64 %r, 1
br i1 %cmp.not4.i, label %factorial.exit, label %for.body.i3.preheader
for.body.i3.preheader: ; preds = %ncr.exit
%xtraiter = and i64 %r, 3
%8 = icmp ult i64 %r, 4
br i1 %8, label %factorial.exit.loopexit.unr-lcssa, label %for.body.i3.preheader.new
for.body.i3.preheader.new: ; preds = %for.body.i3.preheader
%unroll_iter = and i64 %r, -4
br label %for.body.i3
for.body.i3: ; preds = %for.body.i3, %for.body.i3.preheader.new
%i.06.i = phi i64 [ 1, %for.body.i3.preheader.new ], [ %inc.i4.3, %for.body.i3 ]
%ret.05.i = phi i64 [ 1, %for.body.i3.preheader.new ], [ %rem.i.3, %for.body.i3 ]
%niter = phi i64 [ 0, %for.body.i3.preheader.new ], [ %niter.next.3, %for.body.i3 ]
%mul.i = mul i64 %ret.05.i, %i.06.i
%rem.i = urem i64 %mul.i, 1000000007
%inc.i4 = add nuw nsw i64 %i.06.i, 1
%mul.i.1 = mul i64 %rem.i, %inc.i4
%rem.i.1 = urem i64 %mul.i.1, 1000000007
%inc.i4.1 = add nuw nsw i64 %i.06.i, 2
%mul.i.2 = mul i64 %rem.i.1, %inc.i4.1
%rem.i.2 = urem i64 %mul.i.2, 1000000007
%inc.i4.2 = add nuw i64 %i.06.i, 3
%mul.i.3 = mul i64 %rem.i.2, %inc.i4.2
%rem.i.3 = urem i64 %mul.i.3, 1000000007
%inc.i4.3 = add nuw i64 %i.06.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 %factorial.exit.loopexit.unr-lcssa, label %for.body.i3, !llvm.loop !20
factorial.exit.loopexit.unr-lcssa: ; preds = %for.body.i3, %for.body.i3.preheader
%rem.i.lcssa.ph = phi i64 [ undef, %for.body.i3.preheader ], [ %rem.i.3, %for.body.i3 ]
%i.06.i.unr = phi i64 [ 1, %for.body.i3.preheader ], [ %inc.i4.3, %for.body.i3 ]
%ret.05.i.unr = phi i64 [ 1, %for.body.i3.preheader ], [ %rem.i.3, %for.body.i3 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %factorial.exit, label %for.body.i3.epil
for.body.i3.epil: ; preds = %factorial.exit.loopexit.unr-lcssa, %for.body.i3.epil
%i.06.i.epil = phi i64 [ %inc.i4.epil, %for.body.i3.epil ], [ %i.06.i.unr, %factorial.exit.loopexit.unr-lcssa ]
%ret.05.i.epil = phi i64 [ %rem.i.epil, %for.body.i3.epil ], [ %ret.05.i.unr, %factorial.exit.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i3.epil ], [ 0, %factorial.exit.loopexit.unr-lcssa ]
%mul.i.epil = mul i64 %ret.05.i.epil, %i.06.i.epil
%rem.i.epil = urem i64 %mul.i.epil, 1000000007
%inc.i4.epil = add nuw i64 %i.06.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 %factorial.exit, label %for.body.i3.epil, !llvm.loop !50
factorial.exit: ; preds = %factorial.exit.loopexit.unr-lcssa, %for.body.i3.epil, %ncr.exit
%ret.0.lcssa.i = phi i64 [ 1, %ncr.exit ], [ %rem.i.lcssa.ph, %factorial.exit.loopexit.unr-lcssa ], [ %rem.i.epil, %for.body.i3.epil ]
%mul = mul nsw i64 %ret.0.lcssa.i, %7
ret i64 %mul
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @nhr(i64 noundef %n, i64 noundef %r) local_unnamed_addr #8 {
entry:
%pascal.i = alloca [100 x [102 x i64]], align 16
call void @llvm.lifetime.start.p0(i64 81600, ptr nonnull %pascal.i) #21
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(81600) %pascal.i, i8 0, i64 81600, i1 false)
%arrayidx.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 1
store i64 1, ptr %arrayidx.i, align 16, !tbaa !5
%arrayidx3.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 1, i64 1
store i64 1, ptr %arrayidx3.i, align 8, !tbaa !5
br label %for.body.i
for.body.i: ; preds = %for.end.i, %entry
%indvar = phi i64 [ %indvar.next, %for.end.i ], [ 0, %entry ]
%loopA.037.i = phi i64 [ %inc20.i, %for.end.i ], [ 2, %entry ]
%0 = add i64 %indvar, 1
%arrayidx4.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i
store i64 1, ptr %arrayidx4.i, align 16, !tbaa !5
%sub.i = add nsw i64 %loopA.037.i, -1
%arrayidx11.phi.trans.insert.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub.i, i64 0
%.pre.i = load i64, ptr %arrayidx11.phi.trans.insert.i, align 16, !tbaa !5
%min.iters.check = icmp ult i64 %0, 2
br i1 %min.iters.check, label %for.body8.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.i
%n.vec = and i64 %0, -2
%ind.end = or i64 %0, 1
%vector.recur.init = insertelement <2 x i64> poison, i64 %.pre.i, i64 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <2 x i64> [ %vector.recur.init, %vector.ph ], [ %wide.load, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub.i, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = shufflevector <2 x i64> %vector.recur, <2 x i64> %wide.load, <2 x i32> <i32 1, i32 2>
%3 = add nsw <2 x i64> %wide.load, %2
%4 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i, i64 %offset.idx
store <2 x i64> %3, ptr %4, align 8, !tbaa !5
%index.next = add nuw i64 %index, 2
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !51
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %0, %n.vec
%vector.recur.extract = extractelement <2 x i64> %wide.load, i64 1
br i1 %cmp.n, label %for.end.i, label %for.body8.i.preheader
for.body8.i.preheader: ; preds = %for.body.i, %middle.block
%scalar.recur.ph = phi i64 [ %vector.recur.extract, %middle.block ], [ %.pre.i, %for.body.i ]
%loopB.036.i.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body.i ]
br label %for.body8.i
for.body8.i: ; preds = %for.body8.i.preheader, %for.body8.i
%scalar.recur = phi i64 [ %6, %for.body8.i ], [ %scalar.recur.ph, %for.body8.i.preheader ]
%loopB.036.i = phi i64 [ %inc.i, %for.body8.i ], [ %loopB.036.i.ph, %for.body8.i.preheader ]
%arrayidx14.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub.i, i64 %loopB.036.i
%6 = load i64, ptr %arrayidx14.i, align 8, !tbaa !5
%add.i = add nsw i64 %6, %scalar.recur
%arrayidx16.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i, i64 %loopB.036.i
store i64 %add.i, ptr %arrayidx16.i, align 8, !tbaa !5
%inc.i = add nuw nsw i64 %loopB.036.i, 1
%exitcond.not.i = icmp eq i64 %inc.i, %loopA.037.i
br i1 %exitcond.not.i, label %for.end.i, label %for.body8.i, !llvm.loop !52
for.end.i: ; preds = %for.body8.i, %middle.block
%arrayidx18.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i, i64 %loopA.037.i
store i64 1, ptr %arrayidx18.i, align 8, !tbaa !5
%inc20.i = add nuw nsw i64 %loopA.037.i, 1
%exitcond38.not.i = icmp eq i64 %inc20.i, 100
%indvar.next = add i64 %indvar, 1
br i1 %exitcond38.not.i, label %ncr.exit, label %for.body.i, !llvm.loop !47
ncr.exit: ; preds = %for.end.i
%add = add i64 %n, -1
%sub = add i64 %add, %r
%arrayidx23.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub, i64 %r
%7 = load i64, ptr %arrayidx23.i, align 8, !tbaa !5
call void @llvm.lifetime.end.p0(i64 81600, ptr nonnull %pascal.i) #21
ret i64 %7
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #19
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #19
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #20
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #20
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #20
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #20
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #20
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>) #20
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #20
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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 norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree 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 #9 = { 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 #10 = { nofree 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 #11 = { nofree nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { nofree 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 #13 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #14 = { 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 #15 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #16 = { 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 #17 = { 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 #18 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #19 = { nofree nounwind }
attributes #20 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #21 = { nounwind }
attributes #22 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10, !16, !15}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !10}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !7, i64 0}
!23 = !{!24, !24, i64 0}
!24 = !{!"_Bool", !7, i64 0}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !10}
!30 = distinct !{!30, !19}
!31 = distinct !{!31, !10, !15, !16}
!32 = distinct !{!32, !10, !16, !15}
!33 = distinct !{!33, !10, !15, !16}
!34 = distinct !{!34, !10, !16, !15}
!35 = distinct !{!35, !10, !15, !16}
!36 = distinct !{!36, !10, !16, !15}
!37 = distinct !{!37, !19}
!38 = distinct !{!38, !10, !15, !16}
!39 = distinct !{!39, !10}
!40 = !{!7, !7, i64 0}
!41 = distinct !{!41, !10}
!42 = distinct !{!42, !10}
!43 = distinct !{!43, !10, !16, !15}
!44 = distinct !{!44, !10}
!45 = distinct !{!45, !10, !15, !16}
!46 = distinct !{!46, !10, !16, !15}
!47 = distinct !{!47, !10}
!48 = distinct !{!48, !10, !15, !16}
!49 = distinct !{!49, !10, !16, !15}
!50 = distinct !{!50, !19}
!51 = distinct !{!51, !10, !15, !16}
!52 = distinct !{!52, !10, !16, !15}
|
#include<stdio.h>
#include<stdbool.h>
int main(void) {
int N, M;
scanf("%d %d", &N, &M);
char A[50][51];
for(int i = 0; i < N; i++) {
scanf("%s", A[i]);
}
char B[50][51];
for(int i = 0; i < M; i++) {
scanf("%s", B[i]);
}
for(int y = 0; y <= (N-M); y++) {
for(int x = 0; x <= (N-M); x++) {
bool find = true;
for(int i = 0; i < M; i++) {
for(int j = 0; j < M; j++) {
if(B[i][j] != A[y+i][x+j]) {
find = false;
break;
}
}
if(find == false)
break;
}
if(find == true) {
printf("Yes\n");
return 0;
}
}
}
printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117428/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117428/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
%A = alloca [50 x [51 x i8]], align 16
%B = alloca [50 x [51 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
call void @llvm.lifetime.start.p0(i64 2550, ptr nonnull %A) #4
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp103 = icmp sgt i32 %0, 0
br i1 %cmp103, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %3, %for.body ]
call void @llvm.lifetime.start.p0(i64 2550, ptr nonnull %B) #4
%2 = load i32, ptr %M, align 4, !tbaa !5
%cmp4105 = icmp sgt i32 %2, 0
br i1 %cmp4105, label %for.body6, label %for.cond14.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x [51 x i8]], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond14.preheader.loopexit: ; preds = %for.body6
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.cond14.preheader
for.cond14.preheader: ; preds = %for.cond14.preheader.loopexit, %for.cond.cleanup
%5 = phi i32 [ %9, %for.cond14.preheader.loopexit ], [ %2, %for.cond.cleanup ]
%6 = phi i32 [ %.pre, %for.cond14.preheader.loopexit ], [ %1, %for.cond.cleanup ]
%sub113 = sub nsw i32 %6, %5
%cmp15.not114 = icmp slt i32 %sub113, 0
br i1 %cmp15.not114, label %cleanup75, label %for.cond18.preheader.preheader
for.cond18.preheader.preheader: ; preds = %for.cond14.preheader
%cmp25109 = icmp sgt i32 %5, 0
%7 = add nuw i32 %sub113, 1
%wide.trip.count137 = zext i32 %7 to i64
%wide.trip.count132 = zext i32 %5 to i64
%8 = sext i32 %sub113 to i64
br label %for.cond24.preheader.lr.ph
for.body6: ; preds = %for.cond.cleanup, %for.body6
%indvars.iv121 = phi i64 [ %indvars.iv.next122, %for.body6 ], [ 0, %for.cond.cleanup ]
%arrayidx8 = getelementptr inbounds [50 x [51 x i8]], ptr %B, i64 0, i64 %indvars.iv121
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx8)
%indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
%9 = load i32, ptr %M, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp4 = icmp slt i64 %indvars.iv.next122, %10
br i1 %cmp4, label %for.body6, label %for.cond14.preheader.loopexit, !llvm.loop !11
for.cond24.preheader.lr.ph: ; preds = %for.inc69, %for.cond18.preheader.preheader
%indvars.iv139 = phi i64 [ 0, %for.cond18.preheader.preheader ], [ %indvars.iv.next140, %for.inc69 ]
br i1 %cmp25109, label %for.cond24.preheader, label %cleanup75
for.cond24.preheader: ; preds = %for.cond24.preheader.lr.ph, %for.inc64.split.us
%indvars.iv134 = phi i64 [ %indvars.iv.next135, %for.inc64.split.us ], [ 0, %for.cond24.preheader.lr.ph ]
br label %for.cond28.preheader.us
for.cond28.preheader.us: ; preds = %for.cond28.for.inc52_crit_edge.us, %for.cond24.preheader
%indvars.iv128 = phi i64 [ %indvars.iv.next129, %for.cond28.for.inc52_crit_edge.us ], [ 0, %for.cond24.preheader ]
%11 = add nuw nsw i64 %indvars.iv128, %indvars.iv139
br label %for.body31.us
for.cond28.us: ; preds = %for.body31.us
%indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
%exitcond.not = icmp eq i64 %indvars.iv.next125, %wide.trip.count132
br i1 %exitcond.not, label %for.cond28.for.inc52_crit_edge.us, label %for.body31.us, !llvm.loop !12
for.body31.us: ; preds = %for.cond28.preheader.us, %for.cond28.us
%indvars.iv124 = phi i64 [ 0, %for.cond28.preheader.us ], [ %indvars.iv.next125, %for.cond28.us ]
%arrayidx35.us = getelementptr inbounds [50 x [51 x i8]], ptr %B, i64 0, i64 %indvars.iv128, i64 %indvars.iv124
%12 = load i8, ptr %arrayidx35.us, align 1, !tbaa !13
%13 = add nuw nsw i64 %indvars.iv124, %indvars.iv134
%arrayidx40.us = getelementptr inbounds [50 x [51 x i8]], ptr %A, i64 0, i64 %11, i64 %13
%14 = load i8, ptr %arrayidx40.us, align 1, !tbaa !13
%cmp42.not.us = icmp eq i8 %12, %14
br i1 %cmp42.not.us, label %for.cond28.us, label %for.inc64.split.us
for.cond28.for.inc52_crit_edge.us: ; preds = %for.cond28.us
%indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
%exitcond133.not = icmp eq i64 %indvars.iv.next129, %wide.trip.count132
br i1 %exitcond133.not, label %cleanup75, label %for.cond28.preheader.us, !llvm.loop !14
for.inc64.split.us: ; preds = %for.body31.us
%indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
%exitcond138.not = icmp eq i64 %indvars.iv.next135, %wide.trip.count137
br i1 %exitcond138.not, label %for.inc69, label %for.cond24.preheader, !llvm.loop !15
for.inc69: ; preds = %for.inc64.split.us
%indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
%cmp15.not.not = icmp slt i64 %indvars.iv139, %8
br i1 %cmp15.not.not, label %for.cond24.preheader.lr.ph, label %cleanup75, !llvm.loop !16
cleanup75: ; preds = %for.inc69, %for.cond24.preheader.lr.ph, %for.cond28.for.inc52_crit_edge.us, %for.cond14.preheader
%str.sink = phi ptr [ @str.4, %for.cond14.preheader ], [ @str, %for.cond28.for.inc52_crit_edge.us ], [ @str, %for.cond24.preheader.lr.ph ], [ @str.4, %for.inc69 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 2550, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 2550, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
char A[55][55];
char B[55][55];
int main(){
int N,M;
scanf("%d %d",&N,&M);
int i,j,x,y;
for(i=0;i<N;i++){
scanf("%s",A[i]);
}
for(i=0;i<M;i++){
scanf("%s",B[i]);
}
i=0;
j=0;
while(1){
if(i+M-1>=N){break;}
int cnt=0;
for(y=0;y<M;y++){
for(x=0;x<M;x++){
if(A[y+i][x+j]==B[y][x]){cnt++;}
}
}
if(cnt==M*M){
printf("Yes\n");
return 0;
}
j++;
if(j+M-1>=N){
i++;
j=0;
}
}
printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117471/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117471/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@A = dso_local global [55 x [55 x i8]] zeroinitializer, align 16
@B = dso_local global [55 x [55 x i8]] zeroinitializer, align 16
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%M = 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 %M) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp83 = icmp sgt i32 %0, 0
br i1 %cmp83, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %3, %for.body ]
%2 = load i32, ptr %M, align 4, !tbaa !5
%cmp385 = icmp sgt i32 %2, 0
br i1 %cmp385, label %for.body4, label %while.cond.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [55 x [55 x i8]], ptr @A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
while.cond.preheader.loopexit: ; preds = %for.body4
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.loopexit, %for.cond2.preheader
%5 = phi i32 [ %.pre, %while.cond.preheader.loopexit ], [ %1, %for.cond2.preheader ]
%6 = phi i32 [ %27, %while.cond.preheader.loopexit ], [ %2, %for.cond2.preheader ]
%cmp12.not.not94 = icmp sgt i32 %6, %5
br i1 %cmp12.not.not94, label %cleanup55, label %for.cond13.preheader.lr.ph
for.cond13.preheader.lr.ph: ; preds = %while.cond.preheader
%cmp1490 = icmp sgt i32 %6, 0
%mul = mul nsw i32 %6, %6
br i1 %cmp1490, label %for.cond13.preheader.us.preheader, label %for.cond13.preheader.lr.ph.split
for.cond13.preheader.us.preheader: ; preds = %for.cond13.preheader.lr.ph
%wide.trip.count110 = zext i32 %6 to i64
%min.iters.check = icmp ult i32 %6, 8
%n.vec = and i64 %wide.trip.count110, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count110
br label %for.cond13.preheader.us
for.cond13.preheader.us: ; preds = %for.cond13.preheader.us.preheader, %cleanup.us
%j.096.us = phi i32 [ %spec.select80.us, %cleanup.us ], [ 0, %for.cond13.preheader.us.preheader ]
%i.295.us = phi i32 [ %spec.select79.us, %cleanup.us ], [ 0, %for.cond13.preheader.us.preheader ]
%7 = sext i32 %j.096.us to i64
%8 = zext i32 %i.295.us to i64
br label %for.cond16.preheader.us.us
cleanup.us: ; preds = %for.cond13.for.end40_crit_edge.split.us.us
%inc46.us = add nsw i32 %j.096.us, 1
%sub48.us = add i32 %6, %j.096.us
%cmp49.not.us = icmp sge i32 %sub48.us, %5
%inc52.us = zext i1 %cmp49.not.us to i32
%spec.select79.us = add nuw nsw i32 %i.295.us, %inc52.us
%spec.select80.us = select i1 %cmp49.not.us, i32 0, i32 %inc46.us
%add.us = add nsw i32 %6, %spec.select79.us
%cmp12.not.not.us = icmp sgt i32 %add.us, %5
br i1 %cmp12.not.not.us, label %cleanup55, label %for.cond13.preheader.us
for.cond16.preheader.us.us: ; preds = %for.cond16.for.inc38_crit_edge.us.us, %for.cond13.preheader.us
%indvars.iv106 = phi i64 [ %indvars.iv.next107, %for.cond16.for.inc38_crit_edge.us.us ], [ 0, %for.cond13.preheader.us ]
%cnt.092.us.us = phi i32 [ %spec.select.us.us.lcssa, %for.cond16.for.inc38_crit_edge.us.us ], [ 0, %for.cond13.preheader.us ]
%9 = add nuw nsw i64 %indvars.iv106, %8
br i1 %min.iters.check, label %for.body18.us.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond16.preheader.us.us
%10 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %cnt.092.us.us, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %10, %vector.ph ], [ %20, %vector.body ]
%vec.phi116 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %21, %vector.body ]
%11 = add nsw i64 %index, %7
%12 = getelementptr inbounds [55 x [55 x i8]], ptr @A, i64 0, i64 %9, i64 %11
%wide.load = load <4 x i8>, ptr %12, align 1, !tbaa !11
%13 = getelementptr inbounds i8, ptr %12, i64 4
%wide.load117 = load <4 x i8>, ptr %13, align 1, !tbaa !11
%14 = getelementptr inbounds [55 x [55 x i8]], ptr @B, i64 0, i64 %indvars.iv106, i64 %index
%wide.load118 = load <4 x i8>, ptr %14, align 1, !tbaa !11
%15 = getelementptr inbounds i8, ptr %14, i64 4
%wide.load119 = load <4 x i8>, ptr %15, align 1, !tbaa !11
%16 = icmp eq <4 x i8> %wide.load, %wide.load118
%17 = icmp eq <4 x i8> %wide.load117, %wide.load119
%18 = zext <4 x i1> %16 to <4 x i32>
%19 = zext <4 x i1> %17 to <4 x i32>
%20 = add <4 x i32> %vec.phi, %18
%21 = add <4 x i32> %vec.phi116, %19
%index.next = add nuw i64 %index, 8
%22 = icmp eq i64 %index.next, %n.vec
br i1 %22, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %21, %20
%23 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond16.for.inc38_crit_edge.us.us, label %for.body18.us.us.preheader
for.body18.us.us.preheader: ; preds = %for.cond16.preheader.us.us, %middle.block
%indvars.iv102.ph = phi i64 [ 0, %for.cond16.preheader.us.us ], [ %n.vec, %middle.block ]
%cnt.189.us.us.ph = phi i32 [ %cnt.092.us.us, %for.cond16.preheader.us.us ], [ %23, %middle.block ]
br label %for.body18.us.us
for.body18.us.us: ; preds = %for.body18.us.us.preheader, %for.body18.us.us
%indvars.iv102 = phi i64 [ %indvars.iv.next103, %for.body18.us.us ], [ %indvars.iv102.ph, %for.body18.us.us.preheader ]
%cnt.189.us.us = phi i32 [ %spec.select.us.us, %for.body18.us.us ], [ %cnt.189.us.us.ph, %for.body18.us.us.preheader ]
%24 = add nsw i64 %indvars.iv102, %7
%arrayidx24.us.us = getelementptr inbounds [55 x [55 x i8]], ptr @A, i64 0, i64 %9, i64 %24
%25 = load i8, ptr %arrayidx24.us.us, align 1, !tbaa !11
%arrayidx28.us.us = getelementptr inbounds [55 x [55 x i8]], ptr @B, i64 0, i64 %indvars.iv106, i64 %indvars.iv102
%26 = load i8, ptr %arrayidx28.us.us, align 1, !tbaa !11
%cmp30.us.us = icmp eq i8 %25, %26
%inc33.us.us = zext i1 %cmp30.us.us to i32
%spec.select.us.us = add nsw i32 %cnt.189.us.us, %inc33.us.us
%indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
%exitcond.not = icmp eq i64 %indvars.iv.next103, %wide.trip.count110
br i1 %exitcond.not, label %for.cond16.for.inc38_crit_edge.us.us, label %for.body18.us.us, !llvm.loop !15
for.cond16.for.inc38_crit_edge.us.us: ; preds = %for.body18.us.us, %middle.block
%spec.select.us.us.lcssa = phi i32 [ %23, %middle.block ], [ %spec.select.us.us, %for.body18.us.us ]
%indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
%exitcond111.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count110
br i1 %exitcond111.not, label %for.cond13.for.end40_crit_edge.split.us.us, label %for.cond16.preheader.us.us, !llvm.loop !16
for.cond13.for.end40_crit_edge.split.us.us: ; preds = %for.cond16.for.inc38_crit_edge.us.us
%cmp41.not.us = icmp eq i32 %spec.select.us.us.lcssa, %mul
br i1 %cmp41.not.us, label %cleanup55, label %cleanup.us
for.cond13.preheader.lr.ph.split: ; preds = %for.cond13.preheader.lr.ph
%cmp41.not = icmp eq i32 %6, 0
br i1 %cmp41.not, label %cleanup55, label %for.cond13.preheader
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv99 = phi i64 [ %indvars.iv.next100, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [55 x [55 x i8]], ptr @B, i64 0, i64 %indvars.iv99
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
%27 = load i32, ptr %M, align 4, !tbaa !5
%28 = sext i32 %27 to i64
%cmp3 = icmp slt i64 %indvars.iv.next100, %28
br i1 %cmp3, label %for.body4, label %while.cond.preheader.loopexit, !llvm.loop !17
for.cond13.preheader: ; preds = %for.cond13.preheader.lr.ph.split, %for.cond13.preheader
%j.096 = phi i32 [ %spec.select80, %for.cond13.preheader ], [ 0, %for.cond13.preheader.lr.ph.split ]
%i.295 = phi i32 [ %spec.select79, %for.cond13.preheader ], [ 0, %for.cond13.preheader.lr.ph.split ]
%inc46 = add nsw i32 %j.096, 1
%sub48 = add i32 %6, %j.096
%cmp49.not = icmp sge i32 %sub48, %5
%inc52 = zext i1 %cmp49.not to i32
%spec.select79 = add nuw nsw i32 %i.295, %inc52
%spec.select80 = select i1 %cmp49.not, i32 0, i32 %inc46
%add = add nsw i32 %6, %spec.select79
%cmp12.not.not = icmp sgt i32 %add, %5
br i1 %cmp12.not.not, label %cleanup55, label %for.cond13.preheader
cleanup55: ; preds = %for.cond13.preheader, %cleanup.us, %for.cond13.for.end40_crit_edge.split.us.us, %while.cond.preheader, %for.cond13.preheader.lr.ph.split
%str.sink = phi ptr [ @str, %for.cond13.preheader.lr.ph.split ], [ @str.4, %while.cond.preheader ], [ @str, %for.cond13.for.end40_crit_edge.split.us.us ], [ @str.4, %cleanup.us ], [ @str.4, %for.cond13.preheader ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
int main(void) {
char A[60][60];
char B[60][60];
int N,M;
int i,j;
scanf("%d %d",&N,&M);
for(i=0;i<N;i++){
scanf("%s",A[i]);
}
for(i=0;i<M;i++){
scanf("%s",B[i]);
}
int count;
int max;
int num;
int x,y;
int flag;
int yes = 0;
max = M * M;
num = N - M + 1;
for(i=0;i<num;i++){
for(j=0;j<num;j++){
count = 0;
flag = 1;
for(x=0;x<M;x++){
for(y=0;y<M;y++){
if(A[i+x][j+y] == B[x][y]){
count++;
} else {
flag =0;
}
if(flag==0){
break;
}
}
if(flag==0){
break;
}
}
if(count==max){
yes = 1;
}
if(yes){
break;
}
}
if(yes){
break;
}
}
if(yes){
printf("Yes\n");
} else {
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117514/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117514/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [60 x [60 x i8]], align 16
%B = alloca [60 x [60 x i8]], align 16
%N = alloca i32, align 4
%M = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 3600, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 3600, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp99 = icmp sgt i32 %0, 0
br i1 %cmp99, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %3, %for.body ]
%2 = load i32, ptr %M, align 4, !tbaa !5
%cmp3101 = icmp sgt i32 %2, 0
br i1 %cmp3101, label %for.body4, label %for.end11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [60 x [60 x i8]], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv134 = phi i64 [ %indvars.iv.next135, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [60 x [60 x i8]], ptr %B, i64 0, i64 %indvars.iv134
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
%5 = load i32, ptr %M, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp3 = icmp slt i64 %indvars.iv.next135, %6
br i1 %cmp3, label %for.body4, label %for.end11.loopexit, !llvm.loop !11
for.end11.loopexit: ; preds = %for.body4
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.end11
for.end11: ; preds = %for.end11.loopexit, %for.cond2.preheader
%7 = phi i32 [ %1, %for.cond2.preheader ], [ %.pre, %for.end11.loopexit ]
%.lcssa = phi i32 [ %2, %for.cond2.preheader ], [ %5, %for.end11.loopexit ]
%mul = mul i32 %.lcssa, %.lcssa
%cmp13.not115 = icmp slt i32 %7, %.lcssa
br i1 %cmp13.not115, label %if.else70, label %for.cond15.preheader.lr.ph
for.cond15.preheader.lr.ph: ; preds = %for.end11
%cmp19107 = icmp sgt i32 %.lcssa, 0
br i1 %cmp19107, label %for.cond15.preheader.us119.preheader, label %for.cond15.preheader.lr.ph.split.split
for.cond15.preheader.us119.preheader: ; preds = %for.cond15.preheader.lr.ph
%8 = add i32 %7, 1
%9 = sub i32 %8, %.lcssa
%wide.trip.count155 = zext i32 %9 to i64
%wide.trip.count145 = zext i32 %.lcssa to i64
br label %for.cond15.preheader.us119
for.cond15.preheader.us119: ; preds = %for.cond15.preheader.us119.preheader, %for.cond15.for.inc64.loopexit_crit_edge.split.us.us
%indvars.iv152 = phi i64 [ 0, %for.cond15.preheader.us119.preheader ], [ %indvars.iv.next153, %for.cond15.for.inc64.loopexit_crit_edge.split.us.us ]
br label %for.cond18.preheader.us.us
for.cond18.preheader.us.us: ; preds = %for.cond15.us.us, %for.cond15.preheader.us119
%indvars.iv147 = phi i64 [ %indvars.iv.next148, %for.cond15.us.us ], [ 0, %for.cond15.preheader.us119 ]
br label %for.cond21.preheader.us.us.us
for.end51.us.us: ; preds = %for.body23.us.us.us
%cmp52.not.us.us = icmp eq i32 %count.1104.us.us.us, %mul
br i1 %cmp52.not.us.us, label %if.end72, label %for.cond15.us.us
for.cond15.us.us: ; preds = %for.end51.us.us
%indvars.iv.next148 = add nuw nsw i64 %indvars.iv147, 1
%exitcond151.not = icmp eq i64 %indvars.iv.next148, %wide.trip.count155
br i1 %exitcond151.not, label %for.cond15.for.inc64.loopexit_crit_edge.split.us.us, label %for.cond18.preheader.us.us, !llvm.loop !12
for.cond21.preheader.us.us.us: ; preds = %for.cond21.for.inc49_crit_edge.us.us.us, %for.cond18.preheader.us.us
%indvars.iv141 = phi i64 [ %indvars.iv.next142, %for.cond21.for.inc49_crit_edge.us.us.us ], [ 0, %for.cond18.preheader.us.us ]
%count.0108.us.us.us = phi i32 [ %11, %for.cond21.for.inc49_crit_edge.us.us.us ], [ 0, %for.cond18.preheader.us.us ]
%10 = add nuw nsw i64 %indvars.iv141, %indvars.iv152
%11 = add i32 %.lcssa, %count.0108.us.us.us
br label %for.body23.us.us.us
for.body23.us.us.us: ; preds = %for.inc42.us.us.us, %for.cond21.preheader.us.us.us
%indvars.iv137 = phi i64 [ %indvars.iv.next138, %for.inc42.us.us.us ], [ 0, %for.cond21.preheader.us.us.us ]
%count.1104.us.us.us = phi i32 [ %inc37.us.us.us, %for.inc42.us.us.us ], [ %count.0108.us.us.us, %for.cond21.preheader.us.us.us ]
%12 = add nuw nsw i64 %indvars.iv137, %indvars.iv147
%arrayidx29.us.us.us = getelementptr inbounds [60 x [60 x i8]], ptr %A, i64 0, i64 %10, i64 %12
%13 = load i8, ptr %arrayidx29.us.us.us, align 1, !tbaa !13
%arrayidx33.us.us.us = getelementptr inbounds [60 x [60 x i8]], ptr %B, i64 0, i64 %indvars.iv141, i64 %indvars.iv137
%14 = load i8, ptr %arrayidx33.us.us.us, align 1, !tbaa !13
%cmp35.not.us.us.us = icmp eq i8 %13, %14
br i1 %cmp35.not.us.us.us, label %for.inc42.us.us.us, label %for.end51.us.us
for.inc42.us.us.us: ; preds = %for.body23.us.us.us
%inc37.us.us.us = add nsw i32 %count.1104.us.us.us, 1
%indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
%exitcond.not = icmp eq i64 %indvars.iv.next138, %wide.trip.count145
br i1 %exitcond.not, label %for.cond21.for.inc49_crit_edge.us.us.us, label %for.body23.us.us.us, !llvm.loop !14
for.cond21.for.inc49_crit_edge.us.us.us: ; preds = %for.inc42.us.us.us
%indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
%exitcond146.not = icmp eq i64 %indvars.iv.next142, %wide.trip.count145
br i1 %exitcond146.not, label %if.end72, label %for.cond21.preheader.us.us.us, !llvm.loop !15
for.cond15.for.inc64.loopexit_crit_edge.split.us.us: ; preds = %for.cond15.us.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 %if.else70, label %for.cond15.preheader.us119, !llvm.loop !16
for.cond15.preheader.lr.ph.split.split: ; preds = %for.cond15.preheader.lr.ph
%cmp52.not = icmp eq i32 %.lcssa, 0
br i1 %cmp52.not, label %if.end72, label %if.else70
if.else70: ; preds = %for.cond15.for.inc64.loopexit_crit_edge.split.us.us, %for.cond15.preheader.lr.ph.split.split, %for.end11
br label %if.end72
if.end72: ; preds = %for.end51.us.us, %for.cond21.for.inc49_crit_edge.us.us.us, %for.cond15.preheader.lr.ph.split.split, %if.else70
%str.sink = phi ptr [ @str, %if.else70 ], [ @str.4, %for.cond15.preheader.lr.ph.split.split ], [ @str.4, %for.cond21.for.inc49_crit_edge.us.us.us ], [ @str.4, %for.end51.us.us ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 3600, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 3600, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
int main(void)
{
int S, W;
scanf("%d %d", &S, &W);
if (S > W)
printf("safe\n");
else
printf("unsafe\n");
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117565/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117565/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %S) #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 %S, ptr noundef nonnull %W)
%0 = load i32, ptr %S, align 4, !tbaa !5
%1 = load i32, ptr %W, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%str.3.str = select i1 %cmp, 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 %W) #4
call void @llvm.lifetime.end.p0(i64 4, 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 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 S,W;
scanf("%d%d",&S,&W);
if(S <= W)
printf("unsafe");
else
printf("safe");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117608/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117608/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"unsafe\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S, ptr noundef nonnull %W)
%0 = load i32, ptr %S, align 4, !tbaa !5
%1 = load i32, ptr %W, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%.str.2..str.1 = select i1 %cmp.not, ptr @.str.2, ptr @.str.1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #3
call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int S,W;
scanf("%d %d",&S,&W);
if(S<=W){
printf("unsafe\n");
}else{
printf("safe\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117651/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117651/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
@str.3 = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %S) #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 %S, ptr noundef nonnull %W)
%0 = load i32, ptr %S, align 4, !tbaa !5
%1 = load i32, ptr %W, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, 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 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 S,W;
scanf("%d %d",&S, &W);
if(S > W)
printf("safe\n");
else
printf("unsafe\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117695/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117695/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %S) #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 %S, ptr noundef nonnull %W)
%0 = load i32, ptr %S, align 4, !tbaa !5
%1 = load i32, ptr %W, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%str.3.str = select i1 %cmp, 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 %W) #4
call void @llvm.lifetime.end.p0(i64 4, 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 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 s , w;
scanf("%d %d",&s,&w);
if(w>=s)
printf("unsafe\n");
if(s>w)
printf("safe\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117745/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117745/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #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 %s, ptr noundef nonnull %w)
%0 = load i32, ptr %w, align 4, !tbaa !5
%1 = load i32, ptr %s, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr %s, align 4, !tbaa !5
%.pre7 = load i32, ptr %w, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %.pre7, %if.then ], [ %0, %entry ]
%3 = phi i32 [ %.pre, %if.then ], [ %1, %entry ]
%cmp2 = icmp sgt i32 %3, %2
br i1 %cmp2, label %if.then3, label %if.end5
if.then3: ; preds = %if.end
%puts6 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3)
br label %if.end5
if.end5: ; preds = %if.then3, %if.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, 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 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 s, w; scanf("%d %d", &s, &w);
if (s > w) printf("safe\n");
else printf("unsafe\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117789/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117789/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #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 %s, ptr noundef nonnull %w)
%0 = load i32, ptr %s, align 4, !tbaa !5
%1 = load i32, ptr %w, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%str.3.str = select i1 %cmp, 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 %w) #4
call void @llvm.lifetime.end.p0(i64 4, 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 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,k,b,s,w ;
char ch,p,x ;
float g,h ;
int st[100001],ara[3352] ;
scanf("%d %d",&s,&w) ;
if(s>w)
printf("safe") ;
else
printf("unsafe") ;
return 0 ;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117831/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117831/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"safe\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %w)
%0 = load i32, ptr %s, align 4, !tbaa !5
%1 = load i32, ptr %w, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int t, n, temp;
scanf("%d", &t);
for(int i = 0 ; i < t; i++){
scanf("%d", &n);
int a[n], b[n];
for(int j = 0 ; j < n; j++){
scanf("%d", &a[j]);
}
for(int j = 0 ; j < n; j++){
scanf("%d", &b[j]);
}
for(int j = 0 ; j < n; j++){
if(a[j] > b[j]){
temp = a[j];
a[j] = b[j];
b[j] = temp;
}
}
int mx1 = -1; int mx2 = -1;
for(int j = 0 ; j < n; j++){
if(a[j] > mx1) mx1 = a[j];
if(b[j] > mx2) mx2 = b[j];
}
printf("%d\n", mx1 * mx2);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11789/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11789/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64: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) #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 %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp100 = icmp sgt i32 %0, 0
br i1 %cmp100, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup43, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
for.body: ; preds = %entry, %for.cond.cleanup43
%i.0101 = phi i32 [ %inc64, %for.cond.cleanup43 ], [ 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
%cmp488 = icmp sgt i32 %4, 0
br i1 %cmp488, label %for.body6, label %for.cond.cleanup43
for.cond9.preheader: ; preds = %for.body6
%cmp1090 = icmp sgt i32 %6, 0
br i1 %cmp1090, label %for.body12, label %for.cond.cleanup43
for.body6: ; preds = %for.body, %for.body6
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body6 ], [ 0, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp4 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp4, label %for.body6, label %for.cond9.preheader, !llvm.loop !9
for.cond20.preheader: ; preds = %for.body12
%cmp2192 = icmp sgt i32 %9, 0
br i1 %cmp2192, label %for.body23.preheader, label %for.cond.cleanup43
for.body23.preheader: ; preds = %for.cond20.preheader
%wide.trip.count = zext i32 %9 to i64
%xtraiter = and i64 %wide.trip.count, 1
%8 = icmp eq i32 %9, 1
br i1 %8, label %for.cond41.preheader.unr-lcssa, label %for.body23.preheader.new
for.body23.preheader.new: ; preds = %for.body23.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body23
for.body12: ; preds = %for.cond9.preheader, %for.body12
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.body12 ], [ 0, %for.cond9.preheader ]
%arrayidx14 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv104
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx14)
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp10 = icmp slt i64 %indvars.iv.next105, %10
br i1 %cmp10, label %for.body12, label %for.cond20.preheader, !llvm.loop !11
for.cond41.preheader.unr-lcssa: ; preds = %for.inc37.1, %for.body23.preheader
%indvars.iv107.unr = phi i64 [ 0, %for.body23.preheader ], [ %indvars.iv.next108.1, %for.inc37.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond41.preheader, label %for.body23.epil
for.body23.epil: ; preds = %for.cond41.preheader.unr-lcssa
%arrayidx25.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv107.unr
%11 = load i32, ptr %arrayidx25.epil, align 4, !tbaa !5
%arrayidx27.epil = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv107.unr
%12 = load i32, ptr %arrayidx27.epil, align 4, !tbaa !5
%cmp28.epil = icmp sgt i32 %11, %12
br i1 %cmp28.epil, label %if.then.epil, label %for.cond41.preheader
if.then.epil: ; preds = %for.body23.epil
store i32 %12, ptr %arrayidx25.epil, align 4, !tbaa !5
store i32 %11, ptr %arrayidx27.epil, align 4, !tbaa !5
br label %for.cond41.preheader
for.cond41.preheader: ; preds = %for.body23.epil, %if.then.epil, %for.cond41.preheader.unr-lcssa
br i1 %cmp2192, label %for.body44.preheader, label %for.cond.cleanup43
for.body44.preheader: ; preds = %for.cond41.preheader
%wide.trip.count113 = zext i32 %9 to i64
%min.iters.check = icmp ult i32 %9, 8
br i1 %min.iters.check, label %for.body44.preheader133, label %vector.ph
vector.ph: ; preds = %for.body44.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 ], [ %19, %vector.body ]
%vec.phi125 = phi <4 x i32> [ <i32 -1, i32 -1, i32 -1, i32 -1>, %vector.ph ], [ %20, %vector.body ]
%vec.phi126 = phi <4 x i32> [ <i32 -1, i32 -1, i32 -1, i32 -1>, %vector.ph ], [ %15, %vector.body ]
%vec.phi127 = phi <4 x i32> [ <i32 -1, i32 -1, i32 -1, i32 -1>, %vector.ph ], [ %16, %vector.body ]
%13 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %13, align 16, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 4
%wide.load128 = load <4 x i32>, ptr %14, align 16, !tbaa !5
%15 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi126)
%16 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load128, <4 x i32> %vec.phi127)
%17 = getelementptr inbounds i32, ptr %vla2, i64 %index
%wide.load129 = load <4 x i32>, ptr %17, align 16, !tbaa !5
%18 = getelementptr inbounds i32, ptr %17, i64 4
%wide.load130 = load <4 x i32>, ptr %18, align 16, !tbaa !5
%19 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load129, <4 x i32> %vec.phi)
%20 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load130, <4 x i32> %vec.phi125)
%index.next = add nuw i64 %index, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%rdx.minmax131 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %15, <4 x i32> %16)
%22 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax131)
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %19, <4 x i32> %20)
%23 = 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.cond.cleanup43.loopexit, label %for.body44.preheader133
for.body44.preheader133: ; preds = %for.body44.preheader, %middle.block
%indvars.iv110.ph = phi i64 [ 0, %for.body44.preheader ], [ %n.vec, %middle.block ]
%mx2.096.ph = phi i32 [ -1, %for.body44.preheader ], [ %23, %middle.block ]
%mx1.095.ph = phi i32 [ -1, %for.body44.preheader ], [ %22, %middle.block ]
br label %for.body44
for.body23: ; preds = %for.inc37.1, %for.body23.preheader.new
%indvars.iv107 = phi i64 [ 0, %for.body23.preheader.new ], [ %indvars.iv.next108.1, %for.inc37.1 ]
%niter = phi i64 [ 0, %for.body23.preheader.new ], [ %niter.next.1, %for.inc37.1 ]
%arrayidx25 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv107
%24 = load i32, ptr %arrayidx25, align 8, !tbaa !5
%arrayidx27 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv107
%25 = load i32, ptr %arrayidx27, align 8, !tbaa !5
%cmp28 = icmp sgt i32 %24, %25
br i1 %cmp28, label %if.then, label %for.inc37
if.then: ; preds = %for.body23
store i32 %25, ptr %arrayidx25, align 8, !tbaa !5
store i32 %24, ptr %arrayidx27, align 8, !tbaa !5
br label %for.inc37
for.inc37: ; preds = %for.body23, %if.then
%indvars.iv.next108 = or i64 %indvars.iv107, 1
%arrayidx25.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next108
%26 = load i32, ptr %arrayidx25.1, align 4, !tbaa !5
%arrayidx27.1 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv.next108
%27 = load i32, ptr %arrayidx27.1, align 4, !tbaa !5
%cmp28.1 = icmp sgt i32 %26, %27
br i1 %cmp28.1, label %if.then.1, label %for.inc37.1
if.then.1: ; preds = %for.inc37
store i32 %27, ptr %arrayidx25.1, align 4, !tbaa !5
store i32 %26, ptr %arrayidx27.1, align 4, !tbaa !5
br label %for.inc37.1
for.inc37.1: ; preds = %if.then.1, %for.inc37
%indvars.iv.next108.1 = add nuw nsw i64 %indvars.iv107, 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.cond41.preheader.unr-lcssa, label %for.body23, !llvm.loop !15
for.cond.cleanup43.loopexit: ; preds = %for.body44, %middle.block
%spec.select.lcssa = phi i32 [ %22, %middle.block ], [ %spec.select, %for.body44 ]
%mx2.1.lcssa = phi i32 [ %23, %middle.block ], [ %mx2.1, %for.body44 ]
%28 = mul nsw i32 %mx2.1.lcssa, %spec.select.lcssa
br label %for.cond.cleanup43
for.cond.cleanup43: ; preds = %for.cond20.preheader, %for.body, %for.cond9.preheader, %for.cond.cleanup43.loopexit, %for.cond41.preheader
%mul = phi i32 [ 1, %for.cond41.preheader ], [ %28, %for.cond.cleanup43.loopexit ], [ 1, %for.cond9.preheader ], [ 1, %for.body ], [ 1, %for.cond20.preheader ]
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
call void @llvm.stackrestore.p0(ptr %3)
%inc64 = add nuw nsw i32 %i.0101, 1
%29 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc64, %29
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !16
for.body44: ; preds = %for.body44.preheader133, %for.body44
%indvars.iv110 = phi i64 [ %indvars.iv.next111, %for.body44 ], [ %indvars.iv110.ph, %for.body44.preheader133 ]
%mx2.096 = phi i32 [ %mx2.1, %for.body44 ], [ %mx2.096.ph, %for.body44.preheader133 ]
%mx1.095 = phi i32 [ %spec.select, %for.body44 ], [ %mx1.095.ph, %for.body44.preheader133 ]
%arrayidx46 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv110
%30 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %30, i32 %mx1.095)
%arrayidx53 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv110
%31 = load i32, ptr %arrayidx53, align 4, !tbaa !5
%mx2.1 = call i32 @llvm.smax.i32(i32 %31, i32 %mx2.096)
%indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
%exitcond114.not = icmp eq i64 %indvars.iv.next111, %wide.trip.count113
br i1 %exitcond114.not, label %for.cond.cleanup43.loopexit, label %for.body44, !llvm.loop !17
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree 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 <4 x i32> @llvm.smax.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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !14, !13}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.